All Projects → rla → Prolog Target Js

rla / Prolog Target Js

Simple Prolog to JS transpiler

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Prolog Target Js

Go On Rails
🚄 Use Rails to Develop or Generate a Golang Application.
Stars: ✭ 275 (+1347.37%)
Mutual labels:  transpiler
Uniter
🎉 PHP in the browser and Node.js => Docs: https://phptojs.com/
Stars: ✭ 405 (+2031.58%)
Mutual labels:  transpiler
Pseudo
transpile algorithms/libs to idiomatic JS, Go, C#, Ruby
Stars: ✭ 654 (+3342.11%)
Mutual labels:  transpiler
Pytocs
Converts Python source to C#
Stars: ✭ 288 (+1415.79%)
Mutual labels:  transpiler
Wax
A tiny programming language that transpiles to C, C++, Java, TypeScript, Python, C#, Swift, Lua and WebAssembly 🚀
Stars: ✭ 373 (+1863.16%)
Mutual labels:  transpiler
Haxe
Haxe - The Cross-Platform Toolkit
Stars: ✭ 4,665 (+24452.63%)
Mutual labels:  transpiler
idealingua-v1
IdeaLingua RPC for Scala, TypeScript, C#, Go
Stars: ✭ 13 (-31.58%)
Mutual labels:  transpiler
Typescripttolua
Typescript to lua transpiler. https://typescripttolua.github.io/
Stars: ✭ 783 (+4021.05%)
Mutual labels:  transpiler
Bytecoder
Rich Domain Model for JVM Bytecode and Framework to interpret and transpile it.
Stars: ✭ 401 (+2010.53%)
Mutual labels:  transpiler
Rapydscript
Python-inspired, decluttered JavaScript
Stars: ✭ 560 (+2847.37%)
Mutual labels:  transpiler
Transpiler
A universal translator for programming languages
Stars: ✭ 292 (+1436.84%)
Mutual labels:  transpiler
Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (+1831.58%)
Mutual labels:  transpiler
Ruby Next
Ruby Next makes modern Ruby code run in older versions and alternative implementations
Stars: ✭ 460 (+2321.05%)
Mutual labels:  transpiler
Js2php
JavaScript (ES6) to PHP source-to-source transpiler.
Stars: ✭ 290 (+1426.32%)
Mutual labels:  transpiler
Onelang
Stars: ✭ 725 (+3715.79%)
Mutual labels:  transpiler
Il2c
IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Stars: ✭ 270 (+1321.05%)
Mutual labels:  transpiler
Sqlflow
Brings SQL and AI together.
Stars: ✭ 4,412 (+23121.05%)
Mutual labels:  transpiler
Pas2dart
Object Pascal (Free Pascal 3, Delphi 2007) to Dart (2.5) transpiler
Stars: ✭ 16 (-15.79%)
Mutual labels:  transpiler
J2cl
Java to Closure JavaScript transpiler
Stars: ✭ 773 (+3968.42%)
Mutual labels:  transpiler
Nimporter
Compile Nim Extensions for Python On Import!
Stars: ✭ 474 (+2394.74%)
Mutual labels:  transpiler

prolog-target-js

Simple Prolog to JS transpiler. The project is at rather incomplete state at the moment.

Example input:

append([], Ys, Ys).
append([X|Xs], Ys, [X|Zs]):- append(Xs, Ys, Zs).

Example output:

function append_3_0($0, $1, $2, s, cb) {
    var $3 = new Var();
    var _i = s.length;
    s.push(function() {
        return append_3_1($0, $1, $2, s, cb);
    });
    if (!_u(s, $0, '[]')) return _b(s);
    if (!_u(s, $1, $3)) return _b(s);
    if (!_u(s, $2, $3)) return _b(s);
    return cb;
}
function append_3_1($0, $1, $2, s, cb) {
    var $3 = new Var();
    var $4 = new Var();
    var $5 = new Var();
    var $6 = new Var();
    var _i = s.length;
    if (!_u(s, $0, new Struct('.', $3, $4))) return _b(s);
    if (!_u(s, $1, $5)) return _b(s);
    if (!_u(s, $2, new Struct('.', $3, $6))) return _b(s);
    return append_3_0($4, $5, $6, s, cb);
}
exports.append_3 = append_3_0;

Calling the predicate

var runtime = require('../runtime');
var util = require('../util');
var append = require('./append');

var list1 = util.array2List([1, 2, 3, 4, 5]);
var list2 = util.array2List([6, 7, 8, 9, 10]);

var result = new runtime.Var();

runtime.run(append.append_3(list1, list2, result, [], null));

console.log('Result is: ' + runtime.toString(result));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].