[antlr-interest] what is best?

Gavin Lambert antlr at mirality.co.nz
Thu Oct 30 00:48:26 PDT 2008


At 05:39 30/10/2008, Heinrich du Toit wrote:
 >First possbility:
 >
 >a: ('{')=> b
 >    | c;
 >b: '{' ID '}';
 >
 >second possibility:
 >a: b | c ;
 >b: ('{')=> '{' ID '}' ;
 >
 >It's just an example but the question is where do I put the
 >syn-pred for the best effect?

The first is much better.  (On the other hand, it's also usually 
unnecessary, since ANTLR will automatically put in single-token 
lookahead in 'a' to decide between 'b' and 'c' anyway.)



More information about the antlr-interest mailing list