|Grammar ambiguity [message #1839411]
||Sat, 20 March 2021 11:56
| John Doe
Registered: October 2020
I have the following grammar, and it allows some stuff it should not:
name= ID ("if" conditionA+=ConditionA)?
("," ( conditionA+=ConditionA)?
An example from this grammar would be
rule1 if x B y C z , C g
This is a bit complex but I will try to explain it.
1. conditionA, conditionB, and conditionC are optional, because this rule might contain only one of them, two of them or all three of them.
2. I might have a few similar rules, but the ones after the first should not start with an "if", there should only be a comma separating them.
Now my issue is that being that they are all optional, the grammar allows me to write the following:
rule1 , , , ,
What could be a way to fix that, but based on the rules that I mentioned above?
Powered by FUDForum
. Page generated in 0.02432 seconds