gpt4 book ai didi

parsing - 我如何告诉 Bison 我也期待减少-减少冲突?

转载 作者:行者123 更新时间:2023-12-01 22:16:39 27 4
gpt4 key购买 nike

我的 C# 风格的玩具语法现在有了第一个归约-归约冲突!我为自己感到骄傲。

不过,这对我来说似乎没问题(我当时关闭了 GLR 解析器)。问题是,虽然我知道 %expect 指令可以让 Bison 关于移位/归约冲突闭嘴,但我找不到与归约/归约冲突等效的指令。那么我应该用什么来让它对我的 3 次类次/减少和我的 2 次减少/减少保持沉默?

最佳答案

来自 GNU Bison 文档,found here

For normal LALR(1) parsers, reduce/reduce conflicts are more serious, and should be eliminated entirely. Bison will always report reduce/reduce conflicts for these parsers. With GLR parsers, however, both kinds of conflicts are routine; otherwise, there would be no need to use GLR parsing. Therefore, it is also possible to specify an expected number of reduce/reduce conflicts in GLR parsers, using the declaration:

 %expect-rr n

关于parsing - 我如何告诉 Bison 我也期待减少-减少冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2088709/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com