TC-2 Improvements

Possible improvements include:

Resolving all conflicts in your Tiger grammar:

GLR parsers are useful for handling grammars with unresolved conflicts. You are allowed to leave one shift/reduce conflicts in yours, but it can be fixed. Therefore, there will be no use for a GLR parser, and you might want to use a LALR(1) instead.

Introduce an Error class

When syntactic errors are caught, a valid AST must be built anyway, hence a critical question is: what value should be given to the missing bits? If your error recovery is not compatible with what the user meant, you are likely to create artificial type errors with your invented value.

While this behavior is compliant with the assignment, you may improve this by introducing an Error class (one?), which will never trigger type checking errors.

Using Generic Visitors

Andrei Alexandrescu has done a very interesting work on generic implementation of Visitors, see Modern C++ Design. It does require advanced C++ skills, since it is based on type lists, which requires heavy use of templates.

Using Visitor Combinators

Going even further that Andrei Alexandrescu, Nicolas Tisserand proposes an implementation of Visitor combinators, see Generic Visitors in C++.