TC-1/2-Parser Recurring Bugs
- Assertion
map_.empty()failed. A
TWEASTadded an AST node to theMetavarMap’smap_, 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_programfailed. the_programcorresponds 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
ChunkListcontaining theprimitivedeclarations as well as themainfunction. You need to complete the methods forChunkListandFunctionDecin 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 anexpshould be wrapped. Simple as that.