eliminating left recursion [message #1730695] |
Wed, 27 April 2016 13:03  |
Eclipse User |
|
|
|
I saw several posts, and read
typefox.io/parsing-expressions-with-xtext
and
/Xtext/documentation/301_grammarlanguage.html (Assigned Actions)
but I am having some problems with LL recursions
[fatal] rule ruleCompare_expr 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.
[fatal] rule ruleMath_expr 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.
My current grammar is
Expression:
or_ex+=And_expr ('||' or_ex+=And_expr )+ ;
And_expr:
and_ex+=Subtract_expr ('&&' and_ex+=Subtract_expr)+ ;
Subtract_expr:
('!!')*'!(' not_ex+=Expression ')'
| ('!!')*'(' not_ex+=Expression ')'
| not_ex+=Compare_expr;
Compare_expr:
comp+=Math_expr (operator+=('>=' | '<=' | '==' | '!=' | '>' | '<') comp+=Math_expr)+ |
comp+= '(' Compare_expr ')' | // clearly this is one problem, but trying to move compare to a terminal did not help
Math_expr:
math+=Term (operator+=('+' | '-' | '*' | '/' | '%') math+=Term)+ |
math+=Term
;
There is more problems as I go , but I maybe with some guidelines on the current issues, I will be able to solve them by myself?
thank you for your help
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07612 seconds