[antlr-interest] Strange parsing behavior

Gavin Lambert antlr at mirality.co.nz
Tue Apr 7 13:48:38 PDT 2009


At 05:01 8/04/2009, Jim Idle wrote:
>There may be other things in your grammar (you have removed all 
>the warnings and errors?), but this fragment does not do what you 
>want. Use:
>
>prog : (b=ID '{' (ID ';')+ '}' ';')+ { System.out.println("Found 
>block: " + $b.text);}  EOF;

Actually, that's wrong too :)

prog : block+ EOF;
block : b=ID '{' (ID ';')+ '}' ';' { System.out.println("Found 
block: " + $b.text); };



More information about the antlr-interest mailing list