Rule has non-LL(*) decision even tho its copied from a lecture [message #1811127] |
Tue, 27 August 2019 05:05  |
Eclipse User |
|
|
|
Hi
I need to parse Expressions in my DSL and copied the grammar pretty much exactly from here: http://dsl-course.org/
But when I parse it I get two errors:
Quote:
InternalXtextTest.g:6065:3: [fatal] rule ruleOr 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.
InternalXtextTest.g:6131:3: [fatal] rule ruleAnd 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.
I'm really confused why this is happening since my version is practically 1 to 1 what is used everywhere else.
Heres my code for the expressions:
Expression:
Or;
Or returns Expression:
And ({Or.left=current} ('OR' | 'or') right=And)*;
And returns Expression:
Equality ({And.left=current} ('AND' | 'and') right=Equality)*;
Equality returns Expression:
Comparison ({Equality.left=current} ('!=' | '==') right=Comparison)*;
Comparison returns Expression:
PlusOrMinus ({Comparison.left=current} ('>=' | '<=' | '<' | '>') right=PlusOrMinus)*;
PlusOrMinus returns Expression:
MultiOrDivide ({PlusOrMinus.left=current} ('+' | '-') right=MultiOrDivide)*;
MultiOrDivide returns Expression:
Primary ({MultiOrDivide.left=current} ('*' | '/') right=Primary)*;
Primary returns Expression:
'(' Expression ')' | '!' expression=Primary | '-' expression=Primary | Atomic;
Atomic returns Expression:
{Expression} DOUBLE | {Expression} INT | {Expression} STRING | var=[VariableName];
Update:
I found out that it has to do with my VariableName definition. If I exclude that part of the expression that says " | var=[VariableName]" it works fine.
This confuses me even more.
This is my code for VariableAssignments:
VariableAssignment:
name=VariableName '=' value=Expression ';';
VariableName:
name=(ID | TERMINAL_CONSTANT);
[Updated on: Tue, 27 August 2019 05:11] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05888 seconds