[antlr-interest] Simplest working boolean grammar

Gavin Lambert antlr at mirality.co.nz
Mon Sep 17 21:40:28 PDT 2007


At 11:31 18/09/2007, Alfonso wrote:
 >atom    :
 >      NUMBER
 >    | (OPEN_PAREN expression CLOSE_PAREN) => OPEN_PAREN 
expression
 >CLOSE_PAREN
 >    ;
 >
 >NUMBER    : ('0'..'9')+;

If you want to support signed numbers, you'll need to have a 
(PLUS|MINUS)? in either atom (if you want to permit whitespace 
separation from the number) or in NUMBER (if not).  This may 
introduce additional ambiguity, though.



More information about the antlr-interest mailing list