Compiler design semester exam roadmap

Core algorithms

Days 4 to 9: parsing, translation and code generation. 5 topics, about 20 hours.

  1. LL(1) parsing

    About 3 h.

    • Build an LL(1) table and parse a string with it

    Visualisers: LL(1) parsing

  2. LR and operator-precedence parsing

    About 7 h.

    • Build LR(0), SLR, CLR and LALR tables
    • Find shift-reduce and reduce-reduce conflicts
    • Parse with an operator-precedence table

    Visualisers: LR parsing, Operator-precedence parsing

  3. Syntax-directed translation

    About 3 h.

    • Evaluate S- and L-attributed definitions on an annotated parse tree

    Visualisers: Syntax-directed translation

  4. Intermediate code

    About 3 h.

    • Write three-address code, quadruples and triples for an expression
    • Build the DAG of a basic block

    Visualisers: Three-address code & DAG

  5. Optimisation and register allocation

    About 4 h.

    • Apply common subexpression elimination, constant folding and dead-code removal
    • Colour an interference graph to allocate registers

    Visualisers: Code optimisation, Register allocation