





Re: eliminating left recursion [message #1730948 is a reply to message #1730945] 
Sat, 30 April 2016 14:46 

Danny Quizzo <forumsnoreply@xxxxxxxx> wrote:
> but why do you have to do {Evaluation}, I mean if I don't do that I get a
> warning ' may be consumed without object instantiation
> but I am not sure what it means
>
It forces xtext to create an object although xtext by default does this
only if you have at least on assignment













Re: eliminating left recursion [message #1731088 is a reply to message #1731087] 
Mon, 02 May 2016 17:55 

i dont get that. and i have not the time. but you can have a look at
Domainmodel :
(elements+=Object ";")*;
Object :
expressions += Expression
;
Expression:
Disjunction
;
Disjunction returns Expression
: Conjunction ({BinaryExpression.left=current} operator='' right=Conjunction)*
;
Conjunction returns Expression
: Comparison ({BinaryExpression.left=current} operator='&&' right=Comparison)*
;
Comparison returns Expression
: Addition ({BinaryExpression.left=current} operator=('=''!=''<''<=''>''>=') right=Addition)?
;
Addition returns Expression:
Multiplication (({Plus.left=current} '+'  {Minus.left=current} '') right=Multiplication)*;
Multiplication returns Expression:
UnitaryMinus (({Multi.left=current} '*'  {Div.left=current} '/') right=UnitaryMinus)*;
UnitaryMinus returns Expression:
PrimaryExpression  ({UnitaryMinus} (''"!""~") expr=UnitaryMinus);
PrimaryExpression returns Expression:
'(' Expression ')' 
{NumberLiteral} value=Atom trailer+=Trailer*;
Atom:
INT
 FLOAT
 ID;
Trailer:
'[' (index+=Expression)?']'
'.' name=ID (=>trailer+=Trailer)*;
FLOAT: INT ("." INT);



