且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决转移/减少冲突?

更新时间:2022-02-28 21:42:15

您的问题根本不在这些规则之内.尽管迈克尔·莫罗泽克(Michael Mrozek)的回答是解决悬而未决的问题"的正确方法,但它并不能解决当前的问题.

Your problem is not in those rules at all. Although Michael Mrozek answer is correct approach to resolving the "dangling else problem", it does not grasp the problem at hand.

如果查看错误消息,则会发现在对LPAREN进行词法化时出现了shift/reduce冲突.我非常确定,仅规则不会造成冲突.

If you look at the error message, you see that the shift / reduce conflict is present when lexing LPAREN. I am pretty sure that the rules alone will not create a conflict.

我看不到你的语法,所以我帮不了你.但是您的冲突可能是在command之后跟随以LPAREN开头的其他规则.

I can't see your grammar, so I can't help you. But your conflict is probably when a command is followed by a different rule that start with a LPAREN.

查看可能在command之后并以LPAREN开头的其他任何规则.然后,您将必须合并规则.对于特定的输入,您的语法很有可能是错误的.

Look at any other rules that can potentially be after command and start with LPAREN. You will then have to consolidate the rules. There is a very good chance that your grammar is erroneous for a specific input.