Skip to content

long-long-float/AOScript

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
js
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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
}

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published