[antlr-interest] A few questions about AST

G R relationalalgebra at gmail.com
Tue Jun 26 00:57:02 PDT 2007


> The rules:
>
>
>
> predicat:    elementaryPredicat (logicalOperator elementaryPredicat)*;
> //    -> ^(logicalOperator elementaryPredicat elementaryPredicat);
> logicalOperator
>     :    AND
>         | OR;
>
>
>
> can be:
>
>
>
> predicat:    elementaryPredicat (^logicalOperator elementaryPredicat)*;
>
>
> logicalOperator: AND | OR;
>
>
> Parsing the resulting tree is done via a tree parser produced by tree
> grammar or by manually traversing the tree. You need to read the book and/or
> examples for more details.
>
>
>
> Jim.
>

First of all, thanks for your answer Jim.
I have try your way of gathering attributes and it's working perfectly!
Thanks again.
But, I've try your :

predicat:    elementaryPredicat (^logicalOperator elementaryPredicat)*;

and I've got a syntax error (unexpected token ^)
Any idea how to do this ?

Thanks.
G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070626/57c70534/attachment.html 


More information about the antlr-interest mailing list