[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: Removing left recursion...

The problem you have seems the following (again, I'm not an expert and have been using Xtext for a couple of weeks now) if someone else has better ideas please let me also know about this!

Changing the grammer below makes it work for now!
TerminalArithmeticExpression returns LogicExpression: // var=ID |
number=INT
// | BinaryArithmeticExpression
| UnaryArithmeticExpression // | '(' TerminalArithmeticExpression ')'
;


I think you should also left-factor the BinaryAExpression and ofcourse the TerminalAExpression within the TerminalAExpression.
See http://dev.eclipse.org/newslists/news.eclipse.modeling.tmf/msg01376.html for an example how to 'multiple' left-factoring.


The problem for var=ID is that the compiler has trouble knowing that its for "TRUE"|"FALSE" or an ID (think it has to do something with that).

Do you have an EBNF grammer somewhere?

Good luck!
Regards,
Tim