将歧义语法转换为歧义和Slr(1)

我有以下模棱两可的运算符语法

E -> E +E * E |  E-E * E
E->E+E | E-E | E+E | E*E | E/E
E->(E) | x  ````
I must convert it to an unambiguous one which is also SLR(1). The following rules regarding precedence and associativity must hold:

Operators * and / have the highest precedence (and precedence between them must be equal)
Operators - and + have the same precedence (lower than * and /)
All operators are left associative.
Reducing with the first 2 rules is preferred if it does not break the precedence and associativity rules.
My problem is the first line of the grammar ``` (E+E * E,E-E * E) 
``` . I can't find i way to convert it and the new grammar will be SLR(1).
yanguoliu 回答:将歧义语法转换为歧义和Slr(1)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2685315.html

大家都在问