Compilers — Build a Small Language from Start to Finish
From the lexer to x86-64, build a small language yourself
고급 · Lessons 30 · Lab 10
Curriculum
What a Compiler Does — Translate First, or Run Right Away
The Lexer — Characters to Tokens, Positions All the Way
The Parser — Recursive Descent, Pratt, and Error Recovery
Semantic Analysis — Scopes, Name Resolution, and Types Where Known
A Tree-Walking Interpreter — Environments and Closures
Bytecode and a Stack VM — Constant Pool, Slots, Jump Patching
Intermediate Representation and Optimization — Constant Folding, CFGs, Dominators and SSA
x86-64 Code Generation — Calling Convention and Stack Frames
Register Allocation and Garbage Collection — Linear Scan and Mark-Sweep
Reading Real Compilers — Counting gcc and clang Output
Reference docs
- GCC — Options That Control Optimization
- GNU as (Using as) — AT&T 문법
- System V AMD64 ABI (x86-64 psABI)
- LLVM Language Reference Manual
- Python — dis (바이트코드 디스어셈블러)
- Pratt — Top Down Operator Precedence (1973)
- Cytron et al. — Efficiently Computing SSA Form (1991)
- Poletto & Sarkar — Linear Scan Register Allocation (1999)