A native interpreter for Elm
summary
Built a native Haskell interpreter that runs Elm programs so a platform can spin up 100k apps and load state from disk, run update, and store it back. It reuses most of the Elm compiler but replaces the optimized AST with a custom AST and interprets it. Major hurdles are JS semantics baked into the standard library and integer-as-double edge cases, so the implementation removes no floats and reimplements native-library behavior for determinism.
AI-written summary · about
chapters (13)
- 0:00Introduction to native Elm interpreter
- 1:04Elm compiler workflow overview
- 3:58Changes for blockchain smart contracts
- 5:23Building a simple Elm interpreter
- 8:09Adding variables and functions
- 10:41Pattern matching and case expressions
- 11:43Custom types and records
- 12:46Handling negation and edge cases
- 13:29Challenges with JavaScript compatibility
- 14:58Runtime errors and debugging tools
- 15:41Recursion and closures implementation
- 16:23Open-sourcing the interpreter debate
- 17:29Future of Elm in new domains
related talks
35mDeriving an Erlang Interpreter from a Mechanised Formal Semantics of Core Erlang
28mTruffle
43mCreate your own Interpreter with a JIT in 1 hour
43mPolyglot Native: Java, Scala, Kotlin, and JVM languages
46mInventing a language (placeholder title)
42mFunctional interpreters and you
43mLivecoding a WebAssembly interpreter
37mThe Elixir parser under the microscope
