A toy programming language inspired by ML.
main args { print "Hello World" }
npm install
npm run build
After building the project, you can use the joeml CLI to convert joeml code to JavaScript:
# Process a file
npm run joeml example.jml
# Process a file with raw (non-beautified) output
npm run joeml -- -r example.jml
# Show help
npm run joeml -- --help
Create a file hello.jml
:
main {
printLn "Hello, World!"
}
Then run:
npm run joeml hello.jml
This will output the generated JavaScript:
exports.main = function() {
const io = {
stdout: ''
};
function print(str) {
io.stdout += str;
}
function printLn(str) {
io.stdout += str + '\n';
}
function main() {
return printLn("Hello, World!")
};
return function() {
main()
return io;
};
}();
- Functions with parameters
- Let expressions
- If/else expressions
- Basic arithmetic operators (+, -, *, ==, !=)
- String and number literals
- Tail call optimization
foo n {
n + 1
}
bar n {
n + 2
}
main {
foo 1 + bar 2
}