It is sometimes that case that a particular expression value is needed more than once. An example of this is the statement a[i+1]=b[i+1]+c[i+1] where i+1 is used three times. An expression that may be reused is called a redundant or common expression. An AST may be transformed so that an expression that is used more than once has multiple parents (one parent for each context that requires the
same value). An AST node that has more than one parent isn't really a tree anymore. Rather, its a directed-acyclic graph (a dag).
How must code generators for expressions be changed when they are translating an AST node that has more than one parent?