[antlr-interest] Rewrite Problem; Rule terminates without exception.

Olivier Lefevre lefevrol at yahoo.com
Sun Mar 16 13:27:00 PDT 2008


> While I don't really know anything about the Java implementation, is it 
> possible to insert an explicit duplication request in there?

I don't see anything in org.antlr.runtime.tree.BaseTree that would prevent 
a node from being added multiple times in different places (unlike, say, in 
  javax.swing.tree.DefaultMutableTreeNode) [*] but if you do that you no 
longer have a tree, at least in general: you may have a DAG, with cycles. 
Since walkers (e.g., evaluators) assume a "real" tree, that would be bad. 
ANTLR should probably be stricter.

-- O.L.

[*] If I understand the code correctly, it has a check to prevent a node 
from adding itself to itself as a child but that's it.



More information about the antlr-interest mailing list