TC-2 Recurring bugs

Assertion `map_.empty()’ failed.

A TWEAST added an AST node to the MetavarMap’s map_, but it was never retrieved.

Check that you handle the scanning of metavariables correctly, and that you create the corresponding metavariable when you match the metavar grammar rules.

Precondition `the_program’ failed.

the_program corresponds to the root of your ast, and you are supposed to set it to the result of the parsing. Have you looked at every FIXME?

Pretty Printer prints nothing yet does not crash

Your code is wrapped into a ChunkList containing the primitive declarations as well as the main function. You need to complete the methods for ChunkList and FunctionDec in all of your visitors to be able to visit any other node.

When to print parenthesis?

Printing parenthesis around every node is not necessary. Printing in fewer occasions than it should, however, will result in problems now or later. Here is a good example that showcases some of those occasions to reward you for reading this far: (if 1 then (x:=1)+2)+3. In general, every AST node whose rightmost component is an exp should be wrapped. Simple as that.