compiler-constructionlisted
Install: claude install-skill rustcircle/c101
# Compiler construction
From characters to machine code, with the decisions that matter in practice. Language theory
(regular languages, automata, lexer DFAs) lives in `automata-regular-languages`; type checking and
inference in `type-systems-inference`; C/C++ UB detection in `cpp-ub-sanitizers`; regex practice in
`regex-engineering`. Summary facts stay in `cs-foundations` section 8.
Deep material: [SCCP on a toy SSA IR: full Python implementation and golden tests](references/sccp-example.md)
## 1. Pipeline and architecture decision
Pipeline: lex -> parse -> AST/CST -> name resolution and type checking -> lowering to IR (SSA) ->
optimisation -> instruction selection -> register allocation -> scheduling -> emission.
| Architecture | Peak speed | Startup | Effort | Choose when |
|---|---|---|---|---|
| Tree-walking interpreter | lowest | instant | days to weeks | config languages, DSLs, prototypes, teaching |
| Bytecode VM | several times a tree walker | fast | weeks to months | scripting languages, embedded runtimes |
| Existing IR: LLVM, Cranelift, Wasm (wasm-encoder, Binaryen) | near native (LLVM best peak, Cranelift much faster to compile) | LLVM slow to compile; Cranelift JIT-friendly | months | static languages, JITs (Cranelift), portable targets (Wasm) |
| Custom backend | whatever you invest | tunable | years | only with a team and a reason (Go, V8-style tiers) |
Decide by required run-time performance, startup and compile-time budget, and team size. Start one
run