Skip to content

minoki/LunarML

Repository files navigation

LunarML

A Standard ML compiler that produces Lua.

Building

You need a recent version of MLton to build the executable, and Lua 5.3+ to run the compiled script.

$ make
$ make test
$ ./lunarml example/hello.sml
$ lua example/hello.lua
Hello world!

Features

Successor ML features:

  • Monomorphic non-exhaustive bindings
  • Simplified recursive value bindings
    • SML '97-compatible ordering for type variables is also supported: val <tyvarseq> rec <valbind>
  • Abstype as derived form
  • Fixed manifest type specifications
  • Abolish sequenced type realizations
  • Line comments
  • Extended literal syntax
  • Record punning
  • Record extension
    • in patterns
    • in expressions
    • in types
  • Record update
  • Conjunctive patterns
  • Nested matches
  • Pattern guards
  • Optional bars and semicolons
  • Optional else branch
  • Do declarations
  • Withtype in signatures

Other extensions planned:

  • Vector expressions and patterns
  • Packaged modules (like in Alice ML or HaMLet S)
  • Hexadecimal floating-point literals
  • Variably-encoded Unicode escape sequence in string literals