Skip to content

reduce/reduce conflict handling order: difference in documentation vs. code #350

@BestYeen

Description

@BestYeen

Hello,

I've read the documentation and created samples to learn a bit about Happy so I can debug the Haskell grammar for GHC.

This document here: https://github.com/haskell/happy/blob/master/doc/tips.rst
States that when there is a reduce/reduce conflict, the reduction rule that is the uppermost in the grammar file is picked.

Attached is a sample grammar with a main method. This file shows that at least here, not the first, but the last reduction rule is fixed.

Please have a look. If I understood things right and didn't mess it up in my sample code, then either Happy has a bug in its code generation or this is intended design and the documentation reflects this wrong. :)

In ReduceReduceConflict, A should be picked, but B is picked.
This is made visible through the evaluation of test "#1" 3 in main (it should be OK for 2 and Not OK for 3).

Kind regards,
Hai

bug-reduce-reduce-conflict.y.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions