The essential task of this assginment is to associate the declaration of a name to the relevant uses of that declared name.
Even if you are generally familiar with the pattern, the book and assignments use a reflective form of the pattern that is very convenient for the work we do. It is recommended that you read the tutorial and perform the associated exercises to acquaint yourself with this form of the pattern.
For this assignment, you need a working implementation of Lab 7 , in the form of a parser that creates an abstract syntax tree (AST). The AST will need a handful of specialized nodes so that the symbol table visitor can intercept and handle symbol declarations and uses.
There are two ways for you to do this, and either one is acceptable:
The parser is chosen by the static method getParser(String[]) found in SymtabVisitor. The comments there instruct you how to change from the course reference parser to your own.
SymtabVisitor | Found in the submit package, this is the only file you will submit. It contains the visitor as a public class and an implementation of a symbol table as a non-public class. Instructions on its use are found in the code. |
ClassSymtabVisitor | This is the reference implementation of the visitor, found in
classsolutions.jar. Your installed code will use it until
you make the appropriate change in SymtabVisitor,
as directed by the comments.
Be sure to make that change, so that your symbol table vistor is tested. |
ClassBuildSymtab | This is the reference implementation of the symbol table itself, found in classsolutions.jar For this lab, you can continue using this one unless you want to use your own, or the one you developed in Studio, in which case you should make the appropriate change in SymtabVisitor. |
So you must develop a local class within SymtabVisitor (because that's the only file you turn in) that implements the SymInfo interface, and you will have to instantiate it appropriately for a symbol before you insert the symbol into the symbol table.Just implement the getRegister/setRegister methods as stubs—no meaningful implementation of them is needed at this point.
Error: Undefined Referenceand indicate the offending node. The easiest way to do this is to use the out method.
Error: Duplicate declaration