[antlr-interest] Grammar for block comments?

Gavin Lambert antlr at mirality.co.nz
Thu Jul 17 01:38:22 PDT 2008


At 19:56 17/07/2008, Andy Doddington wrote:
 >I haven't had a chance to test this in my app, but when I run it 

 >inside AntlrWorks I get a:
 >
 >            FailedPredicateException(COMMENT, {synpred1}?)

ANTLRworks reacts strangely to predicates sometimes, so it could 
just be that.  But another thing you could try is to reverse the 
order of the alts within the * block.

 >As an aside, doesn't the fact that this relatively simple case
 >seems so hard to crack indicate that Antlr may have a problem?

Yes, ANTLR does indeed have a problem :)  And it's probably this 
one:

   http://www.antlr.org:8888/browse/ANTLR-189

(This issue has been one of my pet peeves for a 
while.  Fortunately I've managed to work around it in most cases 
by doing the sorts of things I've been suggesting to you: merging 
lexer rules, avoiding .s, and introducing explicit syntactic 
predicates.)



More information about the antlr-interest mailing list