Transpiler
A universal translator for programming languages
Install / Use
/learn @jarble/TranspilerREADME
This transpiler is no longer maintained; you should probably use Extism instead.
Universal-transpiler
Universal-transpiler is a source-to-source compiler that translates a small subset of several programming languages into several others. It is also able to translate several metasyntax notations, such as EBNF and ABNF.
Universal-transpiler was written as an experimental "proof-of-concept," so it can only translate relatively simple programs. The translation is not always 100% accurate, but I hope it will still be useful.
The online version of this translator is written in JavaScript, but an experimental version is also being written in Prolog.
A major goal of this project is to translate TypeScript and JavaScript to other languages that compile to C or native code. For example, it's possible to translate a subset of TypeScript to Zig:
var a = {a1:1,b:2};
var b = function(a1:number,b:number):number{
return a + b;
};
This is the compiler's output:
var a=.{.a1=1,.b=2};
var b=struct{fn function(a1:f64,b:f64)f64{
return a+b;}}.function;
How to use the online translator
Some supported features
-
Generics and templates (in several languages)
-
Foreach loops This translator can convert many languages into many others:
-
Lua to Perl or PHP
-
Java to OCaml or [GLSL][1]
Constraint programming and automated reasoning
Universal-transpiler is able to generate code in several constraint programming languages and computer algebra systems, including [MiniZinc](https://jarble.github.io/transpiler/javascript/js_transpiler/test_parser.html#%7B%22inputText%22%3A%22int%20add(int%20a%2Cint%20b)%7B%5Cnreturn%20a%20%2B%20b%3B%5Cn%7D%22%2C%22inputLang%22%3A
