[antlr-interest] ANTLR v3.0.1: Regression from ANTLR v2:?? left recusrsive grammar detected while it's not.

Francis ANDRE francis.andre.kampbell at orange.fr
Mon Aug 11 13:50:37 PDT 2008


Hi ANTLR's

Upon migration from ANTLR v2 to ANTLR v3 on the following snippet

grammar Cobol;
tokens {  DOT='DOT';    SECTION='SECTION';    IDENT='IDENT';}
debut    :    section;

section returns[PROCEDURE_SECTION section = null]
@init {String s;}  :  section = sectionHeader DOT ;

sectionHeader returns[PROCEDURE_SECTION section = null]
    :    IDENT SECTION    { section = $IDENT.getText(); };
 

got this error: [17:39:46] error(211): Cobol.g:2941:6: [fatal] rule 
section 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.

IMHO,  in no way the 'section = ' is a left recursive invocation of the 
section rule, but just the assignment if the result of sectionHeader to 
the PROCEDURE_SECTION section.

What's yours?

FA






More information about the antlr-interest mailing list