On Tue, 2008-10-14 at 14:59 +0200, Mark Langezaal wrote:

> Uhh, subtitles please...
> Do you mean this is a kind of a bug, but there is an easy workaround by
> removing the brackets?
> 



> >> // Input: 1 + 2
> >> // Generated AST: ^(+ 1 2)
> >> okExpr
> >>   :    NUM (('+'|'-')^ NUM)*



basiaclly, I think you want:

NUM ((('+')^|('-')^) NUM)*

You can also do:

NUM (arithOp^ NUM)*;

arithOp : '+' | '-' ;


Though I personally would get rid of all the literals in the parser
grammar and replace them with lexer tokens.

Jim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to