
162 An Introduction to Compiler Construction in a Java World
are more likely to be adding new syntax to j--, together with its functionality. Making
extensions to j-- would require our modifying each of the phases.
Moreover, often the traversal order for one node type differs from that of another. And
sometimes we want to perform actions at a node before, after, and even in between the
traversal of the sub-trees. For example, take a look at codegen() for the JIfStatement:
public void codegen ( CLEmitter o u tput ) {
String elseLabel = output . creat e L a bel ();
String endLabel = output . createLab e l ();
condition . codegen ( output , elseLabel ,