Website

Writing a Lisp

Compiling a Lisp

"This series is an adaptation of Abdulaziz Ghuloum’s excellent paper An Incremental Approach to Compiler Construction, with several key differences:

"See my implementation for reference, but note that it may be incomplete and also may look a little bit different than the compiler detailed in these posts."

Compile heap allocation (strings, symbols, etc)
Compile closures
Add tail-call optimization
Compile complex constants (quote)
Compile variable assignment (set!)
Add macro expander
Add extended forms using macro expander (let*, letrec, etc)
Add support for libraries and separate compilation
Compile foreign function calls
Add error checking to primitives and procedure calls
Compile variable-arity procedures (aka varargs)
Compile apply
Add output ports (kind of like FILE*)
Add write, display
Add input ports
Add a tokenizer in Lisp
Add a reader in Lisp
Add a Lisp interpreter (or compiler) in Lisp


Tags: langdev   native   lisp  

Last modified 29 August 2025