[antlr-interest] tree grammar clarification
Diehl, Matthew J
matthew.j.diehl at intel.com
Mon Jul 2 13:16:29 PDT 2007
I don't know if anyone's replied to this yet...I have over 100 messages
that I haven't checked yet.
>
>The grammar rule I need to translate is:
>
>nonzeros : MYNZTN+ -> ^(MYNONZEROS MNZTN)+
> ;
>
>
>I translated the above rule in my tree grammar as:
>
>nonzeros: ^(MYNONZEROS MNZTN)+
> ;
>
>When I translate the above rule in my tree grammar, ANTLR 3.0
>complains that the + is an unexpected token.
I've run into this problem too. Alls you have to do is add some
parenthesis:
Nonzeros: (^(MYNONZEROS MNZTN))+
And then it's fine. I think this should maybe be fixed (is it a bug?),
but it's not too hard to work around...just makes the code a little
harder to read.
Matt
More information about the antlr-interest
mailing list