Trying to create boolean logic [message #1871589] |
Mon, 30 September 2024 14:45  |
Eclipse User |
|
|
|
Hello all,
I am relatively new to Xtext and I'm trying to create a boolean algebra to implement an if-else language. I copied the method for creating an AST from here: https://eclipse.dev/Xtext/documentation/307_special_languages.html#expressions
I somewhat adapted it for the my boolean algebra but now I'm getting the following error: error(211): ../org.xtext.mcmaster.requirements.gherkin.rgh/src-gen/org/xtext/mcmaster/requirements/gherkin/rgh/parser/antlr/internal/InternalRgh.g:387:2: [fatal] rule ruleMultiFeature 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.
Here is my text code:
Context:
{Context} 'If' '(' check=FeatureExpression ')' 'exists' '{'
steps+=Steps+
'}'
(-> 'else' '{' elseSteps+=Steps+ '}')?
;
FeatureExpression:
MultiFeature
;
SingleFeature:
'Feature' name=Description
;
MultiFeature:
FeatureAndFeature | FeatureOrFeature
;
FeatureOrFeature returns MultiFeature:
FeatureAndFeature ({FeatureOrFeature.left=current} 'OR' right=FeatureAndFeature)*
;
FeatureAndFeature returns MultiFeature:
Primary ({FeatureAndFeature.left=current} 'AND' right=Primary)*
;
Primary returns MultiFeature:
SingleFeature | '(' FeatureOrFeature ')'
;
I'm not sure where I'm going wrong and any help would be appreciated.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02415 seconds