[antlr-interest] HELP NEWBIE: How can I simplify Tree Parser grammar.
ghassempoory at ntlworld.com
Sun May 11 05:50:19 PDT 2003
I have a simple expression parser that generates an expression
tree. I have written a tree parser to walk this tree for further
processing. The tree parser looks a bit like :
#(MUL expression expression)
| #(DIV expression expression)
| #(ADD expression expression)
| #(SUB expression expression)
Well, this works fine.However I would like to simplify this by
doing soemthing like:
#(opnode expression expression)
MUL | DIV | ADD | SUB
ANTLR does not like this, it insists that the tree roots
should be specified directly.
Is there anyway that I could factor out the root nodes?
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest