CSCI 310 Spring 2005, Project 5

Two parts to project 5:
  1. Write a visitor (analysis adapter) that creates a symbol table, based on the Abstract Syntax Tree created at the end of Project 4. That is, after parsing the program, your visitor should traverse the tree building a symbol table as we've discussed in class.

    Writing this visitor includes writing the symbol table (environment). It should include methods that allow you to insert new records, and lookup symbols to return those records. You will also need to write classes to store the data (including the symbol table) for each of the types of declarations in the language (variables, methods, classes).

    Since a variable may be bound in an enclosing scope, your classes will need to include a pointer to their parent scope so you can look for a binding by climbing up the scope levels.

  2. Write a semantic checker (a visitor) that uses the symbol table to look for semantic errors in the program. The list of tasks we wrote up in class are a good starting point. Your visitor for this portion of the program should take a symbol table as an argument to its constructor so you can pass in the results of part 1.

This project can get heavy and confusing -- draw outline and ideas, bring questions to class, come to office hours as necessary. Your greatest success will come from a clear picture in your head of what needs to be done.

Testing will need to verify that correct expressions are accepted and incorrect (semantically) expressions are rejected.

Documentation and structure will be more important on this project since you are writing your own code.


Gary Lewandowski
Last modified: Wed Mar 16 09:21:08 EST 2005