My C#-ish toy grammar now has its first reduce-reduce conflicts! I'm so proud of me.
It seems all right to me, however (I switched off to a GLR parser for the occasion). The problem is, while I know the %expect
directive can shut up Bison about shift/reduce conflicts, I can't find the equivalent for reduce/reduce conflicts. So what should I u开发者_JAVA技巧se to make it silent about my 3 shift/reduces and my 2 reduce/reduces?
From the GNU Bison documentation, 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
精彩评论