[antlr-interest] Possible antlr bug

Waldemar Sauer waldemarsauer at hotmail.com
Wed Aug 8 00:42:54 PDT 2007


The following snippet creates a compile time C# error.  I suspect the same
bug will persist for Java output also.  The problem is that because
backtracking is on, r0 appears to be wrapped in a syntactic predicate
function.  However, the parameter x never makes it that far.

--- grammar snippet ---
grammar zcpp;

options
{
    k=2;
    language=CSharp;
    backtrack=true;
}

// PARSER RULES
r0 [int x]: '*'*;
r1 [int x]: IDENT (r0[x])?;

// LEXER RULES
IDENT :	('a'..'z')+;
--- grammar snippet ---


 - Waldemar




More information about the antlr-interest mailing list