Open Cheongroach opened 9 months ago
Here is a BNF defination in MyCGrammar at current version.
// ... addExpression.Rule = multiplyExpression + addOperator + addExpression | prefixExpression; // BAD here addOperator.Rule = ToTerm("+") | "-"; multiplyExpression.Rule = prefixExpression + multiplyOperator + multiplyExpression | prefixExpression; multiplyOperator.Rule = ToTerm("*") | "/"; prefixExpression.Rule = prefixOperator + factor | factor; // ...
The prefixExpression in line 5 for addExpression must not stand here, it should be a multiplyExpression. Otherwise a multiply expression cannot be solved correctly.
prefixExpression
addExpression
multiplyExpression
(I turn grammar root to expression to show the problem:)
thanks for pointing it out, but remember - these are just sample grammars, not thouroughly tested
Here is a BNF defination in MyCGrammar at current version.
The
prefixExpression
in line 5 foraddExpression
must not stand here, it should be amultiplyExpression
. Otherwise a multiply expression cannot be solved correctly.(I turn grammar root to expression to show the problem:)