0

I'm having a big problem with xtext and I don't really know how to solve it, so there's a small part of the grammar I'm working with:

typename:
    IDENTIFIER=IDENTIFIER | qualified_ident=qualified_ident
;

qualified_ident:
    packagename "." IDENTIFIER
;

packagename:
    IDENTIFIER
;

terminal IDENTIFIER: 
    LETTER (LETTER | DECIMAL_DIGIT)*
;

terminal LETTER:
    'a' .. 'z' | 'A' .. 'Z' | "_"
;

terminal DECIMAL_DIGIT:
    '0' .. '9'
;

And there's the error I get on Eclipse:

error(211): ../org.xtext.example.mydsl/src- 
gen/org/xtext/example/mydsl/parser/antlr/internal/InternalMyDsl.g:7253:2: 
[fatal] rule ruletypename 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.

It says the grammar has left recursion but I can't see it and I don't know how to fix this. I'm having problems like this on the entire grammar but I believe if someone explain to me how to solve that one, I can figure out the rest.

Update: you can see the entire grammar here

Erick
  • 147
  • 2
  • 7

1 Answers1

0

you can change the workflow as follows

    language = StandardLanguage {
        name = "org.xtext.example.mydsl2.MyDsl"
        ...

        parserGenerator = {
            debugGrammar = true
        }
    }

and then use ANTLRworks version 3x to find out where the left recursion is

Christian Dietrich
  • 11,778
  • 4
  • 24
  • 32