1.3.2 • Published 10 years ago

moks v1.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
10 years ago

moks

An interpreted language that I am writing @recursecenter.

Sample program in moks:

let fib n = {
  (n < 2)? {
    1
  } : {
    fib (n-1) + fib (n-2)
  }
}

print (fib 10) // should be 89
print (fib 20) // should be 10946

print (map (\x { x + 1; }) [1 2 3 4]) // should be [2 3 4 5]

Either semicolons OR newlines terminate lines. Do not use both or my parser will throw a cryptic error.

Play with it

Note: moks needs iojs currently since it uses features from v8 that node doesn't have yet

npm i -g moks

This should install the moks interpreter globally.

You can then run moks <path to .mok file> or moks -e "<expressions in valid moks syntax>".

For e.g.,:

moks ./fib.mok
moks -e "let add x y = {  x + y; }; print (add 2 3);"

Future plans

Things/features I plan to experiment with in the future:

  • FFI to Javascript
  • support arrays & maps
  • module system
  • lamda support
  • add nil
  • repl
  • error handling
  • marking side effects syntactically
  • runtime optimizations
  • stack based runtime (currently uses the underlying js runtime stack)
  • macros
  • simple type system
  • pausable and rewindable code editing

Also, if you use emacs, here's a simple emacs major mode for moks.

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago