[antlr-interest] syntax predicate strange behavior

Gavin Lambert antlr at mirality.co.nz
Tue May 1 04:42:19 PDT 2007


At 20:28 1/05/2007, Ilia Kantor wrote:
 >
 >command_arguments:	
 >	command_argument (SEMI command_argument)*;
 >
 >command_argument  :
 >        (WS? WORD WS? MINUS GT) => WS? WORD WS? MINUS GT
 >e=exprs_no_semi |
 >        exprs_no_semi ;

Hmm.  Given that this one appears equivalent to this:

command_argument:
   (WS? WORD WS? MINUS GT)? exprs_no_semi;

... what's in exprs_no_semi?  Does it contain WORDs?  If so, that 
could be the source of the ambiguity.

(Out of curiosity, is there any particular reason why you're not 
merging 'MINUS GT' into a single 'ARROW' token or something?  Or 
why you're treating whitespace as significant instead of simply 
marking it as hidden and forgetting about it?)



More information about the antlr-interest mailing list