[antlr-interest] fixed

Terence Parr parrt at cs.usfca.edu
Sun Nov 21 14:10:34 PST 2010


Actually, i get

/tmp $ a T.g
error(211): T.g:3:3: [fatal] rule a has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2.  Resolve by left-factoring or using syntactic predicates or using backtrack=true option.

for

tree grammar T;
options {ASTLabelType=CommonTree;}
a : ^(ID recurse ID ID) SEMI
  | ^(ID recurse ID) SEMI
    {System.out.println($ID+", "+$b.text);}
  ;
recurse : '(' recurse ')' | INT ;

Ter
On Nov 21, 2010, at 2:07 PM, Terence Parr wrote:

> Hi Jamie, i'm looking at this to see if there is a bug i can fix for 3.3.  So antlr silently accepted the first snippet even though it couldn't produce a DFA?
> Ter
> On Apr 1, 2010, at 10:19 AM, James Briant wrote:
> 
>> Once I managed to get ANTLR to give me the error message, the problem was
>> easy to solve. I had these two lines:
>> 
>> |   ^(IF parenthesizedExpression statement statement)
>> |   ^(IF parenthesizedExpression statement)
>> 
>> And I just changed it to:
>> 
>> |   ^(IF parenthesizedExpression statement statement?)
>> 
>> And now it works fine.
>> 
>> So the problem was definitely an exception in the DFA constructor that was
>> then caught, but ignored, with no warning or error. Once I forced it to
>> report the error, I could fix it.
>> 
>> Jamie
>> 
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 



More information about the antlr-interest mailing list