Compilers · Cluster
Semantic Analysis
Scopes, symbol tables, and type checking passes.
- 01 Resolving Identifier Uses Against a Stack of Lexical Scopes How a semantic pass turns each identifier token into a reference to exactly one declaration, what the scope stack must record, and where a single pass over the tree is not enough.
- 02 Symbol Table Layouts and the Cost of Leaving a Scope Why a compiler symbol table is not just a hash map, how scope exit is made cheap, and what the per-scope-frame and shadow-stack designs each cost in lookup and memory.
- 03 Separate Namespaces and Overload Sets in a Symbol Table How languages keep types, values, tags, and labels in distinct tables, and what changes when one spelling must resolve to a set of candidate declarations instead of a single one.
- 04 Collecting Declarations Before Resolving Any Body How a hoisting pass makes forward and mutual references resolvable, what it must record about ordering and initialization, and which language rules it cannot express.
- 05 Bottom-Up Expression Typing with Inference Variables How a checker types an expression from its children, when it must defer a decision to a metavariable, and how unification and the occurs check close those holes.
- 06 Definite Assignment as a Flow-Sensitive Dataflow Problem How a checker proves every variable is written before it is read, why the answer depends on control flow rather than scope, and how the lattice and transfer functions are chosen.
- 07 Closure Capture, Lexical Scope, and Storage Duration Why capturing a variable is a decision about storage rather than about names, how an escaping frame is moved to the heap, and what breaks when a loop body shares one binding.
- 08 Bidirectional Checking: When a Type Is Synthesized and When It Is Checked How splitting the typing judgment into synthesis and checking makes annotated lambdas and empty literals typable without a global constraint solver, and where the split loses completeness.
- 09 Let-Polymorphism and Where Generalization Happens Why a let-bound definition can be used at several types while a lambda parameter cannot, how the level of a metavariable decides what gets generalized, and what the value restriction protects.
- 10 Error Types and Recovery in a Type Checker How a checker keeps going after the first type error without accepting nonsense, what an error type must absorb, and why the count of reported errors is a design decision.