[antlr-interest] treewalker $expression.text?
Terence Parr
parrt at cs.usfca.edu
Thu Sep 6 15:23:10 PDT 2007
On Sep 6, 2007, at 12:22 PM, Martin Kohl wrote:
> I don't understand what you mean with a single subtree and multiple
> subtrees. As it stands now, my Tree Walker Grammar matches the
> Parser Grammar for most of the rules.
> A few Parser Rules have been rewritten though. Here is an example
> containing a rewritten rule and one that is left alone:
>
> Parser Rule:
>
> tokens {
> PLUS;
> }
> expr
> : aRule PlusTok bRule -> ^(PLUS aRule bRule)
> | aRule MinusTok bRule
> ;
>
> Tree Walker:
> expr
> : ^(PLUS aRule bRule)
> | aRule MinusTok bRule
> ;
this is explained in the book somewhere, but basically start/stop
nodes for tree matching rules don't make a whole lot of sense. if
those rules match single roots, then do $aRule.text etc...
Ter
More information about the antlr-interest
mailing list