Class 12: Semantic Analysis I


Display version (pdf).



Reading (for next class): PLP, Sec. 3.1 and 3.2.


These are due at the beginning of our next class, which is next Friday, October 14. You may want to reference PLP, Section 4.6.

  1. Download the tarball, above and run make to generate a parse tree for the following program:
    x := 5*3 + 4; 
    x > 10 & x/2 < 10;
    (Nothing to turn in for this part.)
  2. Now use that parse tree to write the abstract syntax tree for the same program.
  3. Decorate your AST with the type at each node. Note that "side-effect" statements like assignments and prints should have type "void".