GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - minoki/LunarML: The Standard ML compiler that produces Lua/JavaScript

BranchesTags
Open more actions menu

Latest commit

 

History

1,184 Commits
1,184 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
cm
cm
 
 
docs
docs
 
 
example
example
 
 
lib/lunarml
lib/lunarml
 
 
package
package
 
 
pluto
pluto
 
 
src
src
 
 
test
test
 
 
thirdparty
thirdparty
 
 
util
util
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.readthedocs.yaml
.readthedocs.yaml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
set-version.sh
set-version.sh
 
 
version.mk
version.mk
 
 

Repository files navigation

LunarML

The Standard ML compiler that produces Lua/JavaScript.

The documentation is available at https://lunarml.readthedocs.io/en/latest/.

Trying pre-built binaries

If you obtained an archive named lunarml-{version}-{arch}-{os}.tar.gz:

$ tar xf lunarml-0.3.0-{arch}-{os}.tar.gz
$ cd lunarml-0.3.0
$ make install PREFIX=/opt/lunarml
$ export PATH=/opt/lunarml/bin:$PATH
$ lunarml compile example/hello.sml

Also, Docker image is available:

$ docker pull ghcr.io/minoki/lunarml:latest
$ docker run --rm -v "$(pwd)":/work -w /work ghcr.io/minoki/lunarml:latest lunarml compile example/hello.sml
$ lua example/hello.lua
Hello world!

In case you do not want to use Docker, there are precompiled scripts available in the tarball. You can use install-precompiled-lua target to install lunarml.lua which can be run with Lua 5.3/5.4 and LuaFileSystem.

$ make install-precompiled-lua PREFIX=/opt/lunarml
$ export PATH=/opt/lunarml/bin:$PATH
$ lunarml compile example/hello.sml

You can use install-precompiled-node target to install lunarml.mjs to be run with Node.js.

$ make install-precompiled-node PREFIX=/opt/lunarml
$ export PATH=/opt/lunarml/bin:$PATH
$ lunarml compile example/hello.sml

Warning: Script-compiled LunarML is slow. Use native binary for serious use.

Building and Installing

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

$ make
$ make test-lua
$ make test-lua-continuations
$ make test-luajit
$ make test-nodejs
$ make test-nodejs-cps
$ bin/lunarml compile example/hello.sml
$ lua example/hello.lua
Hello world!

You can install the built binary with make install:

$ make install PREFIX=/opt/lunarml
$ export PATH="/opt/lunarml/bin:$PATH"
$ lunarml compile example/hello.sml

Alternatively, you can use Docker to build and run LunarML.

$ docker build -f package/docker/Dockerfile -t lunarml:0.3.0 .
$ docker run --rm -v "$(pwd)":/work -w /work lunarml:0.3.0 lunarml compile example/hello.sml
$ lua example/hello.lua
Hello world!

Usage

lunarml compile [options] input.(sml|mlb)

Subcommands:

  • compile: Compile a program.
  • check: Type check only.
  • help: Show help.
  • version: Show version information.

Targets:

  • Lua
    • --lua (default): Targets Lua 5.3+.
    • --lua-continuations: Targets Lua 5.3+. Supports one-shot delimited continuations. Also, supports deeply nested handle.
    • --luajit: Targets LuaJIT.
  • JavaScript (ES2020+)
    • --nodejs: Produces a JavaScript program for Node.js. The default extension is .mjs.
    • --nodejs-cps: Produces a JavaScript program for Node.js (CPS mode; supports delimited continuations). The default extension is .mjs.
    • --webjs: Produces a JavaScript program for Web. The default extension is .js.
    • --webjs-cps: Produces a JavaScript program for Web (CPS mode; supports delimited continuations). The default extension is .js.

Output type:

  • --exe (default): Produces Lua/JavaScript program.
  • --lib: Produces a Lua/JavaScript module.

Features

  • Full SML '97 language, including signatures and functors
    • Note that some features conform to Successor ML rather than SML '97.
  • Successor ML features
  • Other language extensions
  • A subset of SML Basis Library
  • ML Basis system for multi-file project
  • Interface to Lua
  • Interface to JavaScript
  • Delimited continuations
  • Other libraries

About

The Standard ML compiler that produces Lua/JavaScript

Topics

luastandard-mltranspiler

Resources

Readme
MIT license
Activity

Stars

460 stars

Watchers

9 watching

Forks

14 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.