
CIS 631, CSE 691 Spring 2008
Programming Project, Part 3: Semantic Analysis
The third part of the programming project is to implement symbol tables, typechecking
and any other semantic analysis for the Decaf language.
Strategy:
1. Write a class to implement the Symbol Table. Include methods to
insert identifiers to the symbol table,
lookup identifiers in the symbol, and to
enter scope and
leave scope.
2. Go back through the recursive descent parsing functions and insert identifiers into the
symbol table whenever the declarations are processed.
3. Write a method to walk the Abstract Syntax Tree produced by the parser and do any
semantic checking required at each node. This will include looking up identifiers in the
symbol table and using the type information for type checking. This method will be a
recursive method that will synthesize types. As discussed in the design session, it will
need inherited attributes as arguments to the method, that can convey context information
for checking return, break and continue statements.
Follow the semantic rules in the document DecafSemanticChecks.3.04.08.doc, from the
design discussion held in class on Tuesday, March 4.
Due Dates:
By Thursday, April 3, midnight, submit files to blackboard, zipped or not, as
convenient.
What to hand in:
Design and test document, can be named README, or some other obvious name,
describing design decisions and test results.
Program files, including code documentation.