Recursion without recursion? [message #893033] |
Mon, 02 July 2012 11:44 |
Hannes Müller Messages: 24 Registered: June 2012 |
Junior Member |
|
|
Hello everyone,
Ok, I have a problem while defining a dsl where formulas like a * (b / 2) should be written. I get errors all the time and after some hours I don't know how to proceed without help. Does enyone knows what the error message means (see error message below)? Or even better why the errors occur (see code below)? I don't see a left recursion like the ones descriped in the documentation (or in one of the blogs of one of the guys who are responsible for xtext).
----------------------------
The following error message occurs (more than once):
"warning(200): ../org.xtext.scannerdomainmodel/src-gen/org/xtext/example/mydsl/parser/antlr/internal/InternalMyDsl.g:1089:2: Decision can match input such as "'+' RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input"
--------------------------------------
Here is the relevant part of my xtext-file:
RecalculateFormula:
complexFormula = ComplexFormula
;
Operant:
parameter = [ParameterWithRecalculate] | integer = INT
;
SimpleFormulaWithoutBrackets:
leftOperant = Operant (operators += FormulaOperator operants += Operant)*
;
SimpleFormulaWithBrackets:
'('SimpleFormulaWithoutBrackets')'
;
SimpleFormularWithOptionalBrackets:
simpleFormularWithoutBrackets = SimpleFormulaWithoutBrackets | simpleFormulaWithBrackets = SimpleFormulaWithBrackets
;
ComplexFormula:
leftFormula = SimpleFormularWithOptionalBrackets (operators += FormulaOperator formulas += SimpleFormularWithOptionalBrackets)*
;
--------------------------
I have an additional hint:
When I only use the SimpleFormulaWithBrackets rule instead of the SimpleFormularWithOptionalBrackets rule in the ComplexFormula rule it works. But I want optional brackets!
And: If I want to add the following Rule to the operants again those error messages occur:
Operant:
parameter = [ParameterWithRecalculate] | integer = INT //| double = Double
;
Double:
predecimalNumber = INT('.'decimalNumber = INT)?
;
I would be gratefule for any hint.
THX in advance
Hannes
[Updated on: Mon, 02 July 2012 12:10] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04488 seconds