Compiler design
- Lexical analysis: A maximal-munch lexer DFA turns characters into tokens and fills the symbol table.
- Left recursion & factoring: Remove direct and indirect left recursion, then left factor, rule by rule.
- FIRST & FOLLOW: Compute FIRST and FOLLOW sets pass by pass, with the reason for every symbol.
- LL(1) parsing: Predictive parsing table, conflicts, and a stack trace that grows the parse tree.
- LR parsing: LR(0), SLR, LALR and CLR: item sets, tables, conflicts and bottom-up parses.
- Operator-precedence parsing: LEADING and TRAILING, the ⋖ ≐ ⋗ table, precedence functions and shift-reduce parses.
- Syntax-directed translation: Annotated parse trees: synthesised and inherited attributes evaluated in dependency order.
- Three-address code & DAG: Syntax tree to TAC, DAG with common subexpressions, quadruples and triples.
- Code optimisation: Leaders, basic blocks and the flow graph, then folding, propagation, CSE and dead code, one rewrite at a time.
- Register allocation: Liveness to a fixed point, the interference graph, then Chaitin's simplify, spill and select with k registers.