Houjun Liu

Compilers Index

cs143.stanford.edu

Lectures

Lexing

Logistics

  • programming assignments: myth
  • psets: gradescope
  • labs: myth.stanford.edu
    • /afs/ir/class/cs143
  • finals and midterms

Textbook: the purple dragonbook

Structure

  • written assignments (2.5*4 = 10%)
  • programming assignments (10+10+15+15 = 50%); 4 of them
    • lexer
    • parser
    • semantic analysis parse
    • code generator
  • midterm (15%)
  • final (25%)

Compiler we will Build

  • lexer: strings -> tokens
    • built with Flex FSTs
    • smallest part of the code
  • parser: tokens -> AST
    • built with Bison CFGs
    • linear time parsing!
  • semantic analysis: AST
    • C++
    • check types + properties
    • fill in types for expressions in the tree
  • [PA5: optimization - TBD]
  • code generation: AST -> MIPS
    • C++
    • write MIPS
    • yay!

Emphasis: correctness over performance.