[antlr-interest] Fundamental tree parsing question
ted.villalba at gmail.com
Tue Jul 10 11:03:39 PDT 2007
I'm stuck trying to figure out how to distinguish between multi-term values
in a syntax tree.
For instance, the following rule rewrites to a simple tree:
field : tag '=' LPAREN value RPAREN -> ^('=' tag value)
Here the root node is '=', and the children are both tag and value. The
problem is, if tag has multiple tokens, and value is multiple tokens, there
is no way (that I know of yet) to determine where 'tag' stops and 'value'
So something like :
TAG A=(THE TREE TEST)
Will give you:
^(= TAG A THE TREE TEST)
If I want to reference the value for tag at this point, I don't know how.
This would seem a basic problem, but I haven't found any similar examples in
the literature. Has anyone run into this issue and how did you resolve it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest