haskell / haskell/happy

Grammar that bison/byacc reports 35 reduce/reduce conflicts but happy none

Open
#260 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
322
Forks
86
PR merge metrics
No merged PRs in 30d

Description

While converting this grammar https://github.com/diku-dk/futhark/blob/master/src/Language/Futhark/Parser/Parser.y to use in https://mingodad.github.io/parsertl-playground/playground/ I found that bison/yacc/kmyacc reports 35 reduce/reduce conflicts but `happy` none.

Attached is the grammar converted using `happy` `-i` command line to get the expanded grammar and adding the missing parts manually (`%tokens`, `%prec`, ...):
```
happy -v
Happy Version 1.19.8 Copyright (c) 1993-1996 Andy Gill, Simon Marlow (c) 1997-2005 Simon Marlow

happy -i Parser.y

bison-nb -v Parser-yacc.y
Parser-yacc.y: warning: 35 reduce/reduce conflicts [-Wconflicts-rr]
Parser-yacc.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
Parser-yacc.y:209.8-21: warning: rule useless in parser due to conflicts [-Wother]
209 | Exp2 : Atom ".." Exp2 ;
| ^~~~~~~~~~~~~~

```


[grammars.zip](https://github.com/haskell/happy/files/13378221/grammars.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.