Debugging and testing your syntax tree
The trees that you build must be rock solid. What this spectacular mixed metaphor means is if your syntax tree structure is not built correctly, you can’t expect to be able to build the rest of your programming language. The most direct way of testing that the tree has been constructed correctly is to walk back through it and look at the tree that you have built. Actually, you need to do that for all possible trees!
This section contains two examples of traversing and printing the structure of syntax trees. You will print your tree first in a human-readable (more or less) ASCII text format, then you will learn how to print it out in a format that is easily rendered graphically using the popular open source Graphviz package, commonly accessed through PlantUML or the classic command-line tool called dot. First, consider some of the most common causes of problems in syntax trees.
Avoiding common syntax tree bugs
The most common...