LunarML: From Standard ML to Scripting Languages
summary
LunarML is a Standard ML ’97 compiler that actually compiles itself and runs HaMLet, targeting Lua and JavaScript backends. It implements the full language plus a subset of the ML Basis Library, uses a CPS intermediate representation and trampolines for engines missing tail calls, and chooses a 53‑bit/54‑bit integer strategy to avoid JS precision loss. The JavaScript backend implements multi‑prompt delimited continuations via CPS, supports Lua 5.3/5.4 quirks, and works but currently runs slow on script targets.
AI-written summary · about
chapters (14)
- 0:00LunarML project intro
- 1:30Targeting Standard ML & JS
- 3:13Compiler architecture & CPS
- 5:30Factorial to JavaScript
- 8:07R5RS Scheme intro
- 10:36JS targeting challenges
- 14:10Text encoding differences
- 14:55JS integer representation
- 16:41Delimited continuations
- 20:12UTF & hex float extensions
- 23:07Infix operators & identifiers
- 24:14Type comments for compat
- 25:18Project status & plans
- 26:05Q&A
related talks
43mWhat, if anything, is a llama?
45mEmscripten
48mCross-Domain Compilation: Exploiting Synergies Across the CS Community
26mMake Your Own Programming Language!
13mBrewing JavaScript: Compile your own domain-specific language to JavaScript
32mgLua: A modern Lua transpiler in Scheme
30mLow Level JavaScript
34mModernizing Standard ML of New Jersey: A Status Report
