Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Indirect left recursion
Indirect left recursion [message #1823816] Thu, 02 April 2020 13:56 Go to next message
Udo Günthner is currently offline Udo GünthnerFriend
Messages: 1
Registered: April 2020
Junior Member

the following grammar does not compile because of a non-LL(*) decision ...

grammar udo.test.Test hidden(WS)

import "" as ecore
generate test...

    a=E ';';

E returns ex:
    A ({ex.left=current} '|'? right=A)*;

A returns ex:
    P ({ex.left=current} '+' right=P)*;

P returns ex:
    O ({ex.left=current} right=P) | T;

T returns ex:
    '(' right=E ')' | c='X';

O returns ex:
    o=('+' | '-');

terminal WS:
    ' ';

Can anyone please point me to the left recursion here? And how to refactor it?
Thank you
Re: Indirect left recursion [message #1823878 is a reply to message #1823816] Fri, 03 April 2020 12:26 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 125
Registered: February 2016
Senior Member
Hello Udo,

have you already considered the section of the Xtext documentation?

Hope that helps,
Re: Indirect left recursion [message #1823886 is a reply to message #1823878] Fri, 03 April 2020 13:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13724
Registered: July 2009
Senior Member
the problematic point is the
maybe doing a

and opening the generated debug grammar in antlrworks 3 helps to analyze

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: Indirect left recursion [message #1824091 is a reply to message #1823886] Tue, 07 April 2020 19:41 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 742
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Also consider Holger's blog:
Previous Topic:Any VSCode Directions Updates?
Next Topic:Problem with Xtext running in tomcat 9.0.16 guice 4.2.3, Xtext 2.20.0
Goto Forum:

Current Time: Mon Jan 25 23:53:36 GMT 2021

Powered by FUDForum. Page generated in 0.01382 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top