[antlr-interest] Proglem about the root of ASTree
Bryan Ewbank
ewbank at gmail.com
Thu Sep 21 05:40:31 PDT 2006
Yes, this is a restriction - the '^' has to be at a token, because
that way it's guaranteed to be a single tree node. Rewrite it this
way:
test : ID ( ">"^ | "<"^ ) expr ;
Hope this helps,
- Bryan Ewbank
On 9/21/06, sishen <sishen_freecity at 126.com> wrote:
> I set buildAST = true;
>
> I found something doesn't work when i defined a root.
>
>
> for example:
>
> test : ID op expr
>
> op:
> ">"
> | "<"
> ;
>
>
> i want "op" to be the root of expression.
> but i can't just write "op^". it's a fault.
>
> However, when i write op suffix the operator ">"/"<". it's also unuseful.
>
> What should i do? thx all~
>
>
More information about the antlr-interest
mailing list