AOScript is an simple functional language which has C-like syntax.
$ npm i
$ `npm bin`/gulp
load aoscript.js in your html file.
var aoscript = require('./dist/aoscript.js');$ npm test
// simple
aoscript.eval(code);
// using an environment
var env = new aoscript.Environment(null);
aoscript.eval(code, env);
var exitcode = aoscript.applyFunction(env.getValue('main!'), []).toObject();[Int] map([Int] list, (Int -> Int) f) {
match(list) {
[] -> []
Cons(x, xs) -> Cons(f(x), map(xs, f))
}
}
Int main!() {
val list = [1, 2, 3]
print!(list.map(Int fun(Int n){ n * 2 }))
0
}