Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » left recursive error(left recursive error)
left recursive error [message #1740779] Thu, 18 August 2016 13:42 Go to next message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
Hi,

Can anyone tell me how to solve left recursive error?

index.php/fa/26774/0/

Expression:
LogicalOr
;
LogicalOr :
BitwiseOr ({LogicalOr.left=current} '||' right=PlusMinus)*
;
BitwiseOr :
LogicalAnd ({BitwiseOr.left=current} '|' right=LogicalAnd)*
;
LogicalAnd :
BitwiseAnd ({LogicalAnd.left=current} '&&' right=BitwiseAnd)*
;
BitwiseAnd :
Equivalency ({BitwiseAnd.left=current} '&' right=Equivalency)*
;
Equivalency :
Relational (({Equivalency.left=current} '==' | {NotEquivalency.left=current} '!=' | {Assignment.left=current}'=') right=Relational)*
;
Relational :
PlusMinus (({Ge.left=current} '>='| {le.left=current} '<='| {Gt.left=current} '>'| {lt.left=current} '<') right=PlusMinus)*
;
PlusMinus:
DivMult (({Plus.left=current}'+'| {Minus.left=current}'-') right=DivMult)*
;
DivMult:
LogicalNot (({Multiply.left=current} '*'| {Division.left=current}'/') right=LogicalNot)*
;
LogicalNot :
OnesComplement ({LogicalNot.left=current} '!' right=OnesComplement)*
;
OnesComplement :
Exponentiation ({OnesComplement.left=current} ('~') right=Exponentiation)*
;
Exponentiation :
ColonOperator ({Exponentialtion.left=current} '^' right=ColonOperator)*
;
ColonOperator :
PercentOperator | ({ColonOperator} (':'('+')?) expr=PercentOperator)
;
PercentOperator :
ArrowExpression | ({PercentOperator} ('%'|'%t'|'%.'|'%:') expr=ArrowExpression)
;
ArrowExpression :
Concatenation | ({ArrowExpression} ('->') expr=Concatenation)
;
Concatenation :
Primary ({Concatenation.left=current} '##' right=Primary)*
;
Primary:
string=STRING | number=NUMBER | variable=ID (ArrayLiteral+=ArrayLiteral* & SizeLiteral+=SizeLiteral*) | ('(' expression=Expression ')') | expression=Expression;
Re: left recursive error [message #1740787 is a reply to message #1740779] Thu, 18 August 2016 14:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13879
Registered: July 2009
Senior Member
this means: your grammar is left recursive.
and the problem is here

Primary:
string=STRING | ('(' expression=Expression ')') | expression=Expression;

why is there a

| expression=Expression;


?????


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: left recursive error [message #1740790 is a reply to message #1740787] Thu, 18 August 2016 14:37 Go to previous message
Sachin Samaram is currently offline Sachin SamaramFriend
Messages: 271
Registered: April 2016
Senior Member
yes I understood and removed it.
Previous Topic:[SOLVED] ValidationTestHelper - getting the correct messageParts for assertError
Next Topic:xtext create open declaration
Goto Forum:
  


Current Time: Mon Apr 12 14:06:24 GMT 2021

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

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

Back to the top