Add a semantic checker to your compiler. It should do the checks on the list below as well as any others that are appropriate (I may have missed some -- look at the semantic description in the C-Minus handout and your class notes). It should also build a symbol table for use during checking and in code generation. You must use a Visitor class to do the checking and build the symbol tables. Use good style (including meaningful variable names and appropriate indentation) in your coding and be liberal with comments.
Your semantic checker should be written so that input is the abstract syntax tree from project 4 and output includes a decorated AST and symbol tables containing all functions and variables in the program. Your symbol tables should include an option to print out their contents (symbol, data type, line number where declared). There should be a way to print all symbol tables associated with a program (by traversing the tree, for example). Error messages should include a description of the error as well as the line number where it occurred. If there were scanner or parser errors on a program, you do not need to run the semantic checking (so put a check to stop after parsing in this case).
Semantic errors
You should test your semantic checker on test cases and make corrections as necessary. As always, you will also be graded on the quality of your test cases. Include comments in your test cases indicating what is being tested in each.