AOScript is an simple functional language which has C-like syntax.
JavaScript CoffeeScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
dist
js
src
test
.gitignore
README.md
gulpfile.js
index.html
package.json

README.md

AOScript

AOScript is an simple functional language which has C-like syntax.

Build

$ npm i
$ `npm bin`/gulp

for browser

load aoscript.js in your html file.

for Node.js

var aoscript = require('./dist/aoscript.js');

Run tests

$ npm test

Usage

// 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();

Sample

[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
}