此 yacc 代码中是否存在移位/归约错误?
我收到 yacc 发来的消息,说存在移位/归约冲突。我认为它来自 yacc 文件的这一部分。
statement : expression_stmt
| compound_stmt
| selection_stmt
| iteration_stmt
| return_stmt ;
selection_stmt : IF '(' expression ')' statement
| IF '(' expression ')' statement ELSE statement ;
expression : var '=' expression | simple_expression ;
你能看到冲突吗?如何解决?
I'm getting a message from yacc saying that there is a shift/reduce conflict. I think it's coming from this part of the yacc file.
statement : expression_stmt
| compound_stmt
| selection_stmt
| iteration_stmt
| return_stmt ;
selection_stmt : IF '(' expression ')' statement
| IF '(' expression ')' statement ELSE statement ;
expression : var '=' expression | simple_expression ;
Can you see a conflict? How can it be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我看到了冲突。
selection_statement
规则匹配But that's ambigacy 这样的表达式。也可能是
Yes, I'm seeing a conflict. The
selection_statement
rule matches expressions likeBut that's ambiguous. It could also be