Re: Different conflicts between byacc and bison

Domingo Alvarez Duarte <[email protected]> Thu, 4 Nov 2021 09:57:15 +0100
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
Also tested with the latest byacc from https://invisible-island.net/byacc/:

====

./yacc -V
./yacc - 2.0 20210808

byacc-20210808/yacc gram.y
byacc-20210808/yacc: 21 shift/reduce conflicts, 3 reduce/reduce conflicts.

====

On 3/11/21 19:27, Domingo Alvarez Duarte wrote:
> Hello !
>
> I'm trying to build the CFRONT parser with bison instead of byacc and 
> I've got bison to accept the grammar 
> https://github.com/mingodad/cfront-3/blob/master/src/gram.y but the 
> generated parser by bison has a small difference in the conflicts 
> found in the grammar (see bellow) and also by comparison I tested the 
> last C++ grammar from GCC 3.3.6 
> https://github.com/gcc-mirror/gcc/blob/releases/gcc-3.3.6/gcc/cp/parse.y 
> and there byacc and bison seem to agree on the conflicts.
>
> I tested with two bison versions and both give the same results but 
> the generated parser do not pass the tests.
>
> I'm pointing this here because it seems to be a good example of a 
> corner case maybe not noticed so far.
>
>
> bison (GNU Bison) 3.0.4
> bison (GNU Bison) 3.8.2
>
> byacc - 1.9 20140715
>
> ====
>
> cfront-3/src$ bison -y gram.y
> gram.y: warning: 20 shift/reduce conflicts [-Wconflicts-sr]
> gram.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
>
> cfront-3/srv$ byacc gram.y
> byacc: 21 shift/reduce conflicts, 3 reduce/reduce conflicts.
>
> ====
>
> ====
>
> gcc-3.3.6/gcc/cp$ bison -y parse.y
> parse.y: warning: 33 shift/reduce conflicts [-Wconflicts-sr]
> parse.y: warning: 58 reduce/reduce conflicts [-Wconflicts-rr]
>
> gcc-3.3.6/gcc/cp$ byacc parse.y
> byacc: 33 shift/reduce conflicts, 58 reduce/reduce conflicts.
>
> ====
>
> Cheers !
>