Building My First Lisp Compiler
summary
Five years of work produce MAGIC, a Clojure-written compiler that MAGIC compiles Clojure to CLR bytecode, bootstraps itself and bootstrapped and passes Clojure test-suite, aimed at Unity/Arcadia and funded for final work by Flybot. Implementation choices: emitter-first workflow, an introspection tool inspired by SharpLab, and a symbolic bytecode (mage) immutable IR that makes emission pure data. Remaining pain points: analysis arrives late (need lowering passes), platform quirks like ECMA stack-empty for try and il2cpp crashing on code after throw.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:38What is Magic
- 2:52Structure
- 10:25What Worked
- 12:37Workflow
- 14:50Symbolic bytecode
- 18:02Rethink the analyzer
- 22:25Keep the compiler interesting
- 23:50Build your own API
- 26:00Source of Complexity
- 28:36Source Language
- 30:27Tooling
- 33:17Conclusion
related talks
40mSymbolic Assembly: Using Clojure to Meta-program Bytecode
33mThe Language of the Language: Comparing compiler construction in Clojure and F#
32mEnter the Dragon: Taming LLVM
42mThe Macronomicon
38mLearn you some Lisp for Great Good
48mCross-Domain Compilation: Exploiting Synergies Across the CS Community
38mDemystifying compilers by writing your own
38mFireside chat
