Re: Resolving shift/reduce conflicts?

Hans Åberg <[email protected]> Tue, 2 Feb 2021 10:22:40 +0100
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
> On 2 Feb 2021, at 07:50, Christoph Grüninger <[email protected]> wrote:
> 
> Dear Bisons,
> 
> I have another issue within the CMake parser code. When using the
> attached cmDependsJavaParser.y with Bison 3.7.5, i get the following
> warning: 4 shift/reduce conflicts [-Wconflicts-sr]. When adding
> -Wcounterexamples I get the output below. Ok, I understand the issue and
> Bison is right.
> But what should I do to get rid of the problem?

One way is to add precedences %left, %right, %nonassoc, to the tokens immediately before and after the parsing dot . in the conflicting rules. If there are no such tokens, the grammar must be rewritten, or using GLR.