Compiling with Continuations
3 days ago
- #Continuations
- #Standard ML
- #Compiler Design
- The book 'Compiling with Continuations' by Appel (1992) is a deep dive into Standard ML and practical applications of continuations.
- It lacks exercises, making it less suitable for structured study but rich in detailed information.
- The book covers compiling to machine code, including runtime system interfaces and garbage collection.
- MiniML, a subset of Standard ML, is used for representing elaborated programs and can be compiled into Lambda and then CPS.
- Lexing and parsing are done using lex and yacc, similar to Standard ML's canonical implementation.
- Evaluation involves compiling AST into CPS language, using CPS semantics for optimization checks.
- The CPS language is central for optimizations, with chapters dedicated to inlining, simplification, and hoisting.
- Closure conversion and register spilling are discussed, with solutions provided for common problems.
- The book describes a virtual machine and garbage collector but lacks detail on runtime implementation.
- Despite its depth, the book's focus on CPS as an intermediate representation has become outdated, with SML/NJ moving to MLRISC and LLVM.