Skip to content

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

Notifications You must be signed in to change notification settings

long-long-float/AOScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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