[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Different conflicts between byacc and bison
From: |
Akim Demaille |
Subject: |
Re: Different conflicts between byacc and bison |
Date: |
Sat, 20 Nov 2021 08:53:29 +0100 |
Hi Domingo,
> Le 15 nov. 2021 à 12:44, Domingo Alvarez Duarte <mingodad@gmail.com> a écrit :
>
> Hello Akim !
>
> Thanks for reply !
>
> I did a comparison between lemon (from sqlite) byacc (from
> https://invisible-island.net/byacc/byacc.html) and bison with a custom
> command line option to ignore all precedence settings then tested with
> sqlite3/cfront3 grammar (see here
> https://github.com/mingodad/lalr-parser-test).
That's great. Can you make available the grammars themselves in the repo? It
might be troublesome wrt licenses, I don't know.
> For sqlite3 grammar:
>
> lemon : zero conflicts
> byacc/bison: 53 reduce/reduce conflicts
This is very surprising. I venture that lemon has some system to "solve" RR
conflicts? Something like precedence directives applied to RR conflicts. This
is not something one can do in Yacc (and so far I have resisted to proposals
because their scope is too narrow).
We should study the simplest of these conflicts in Yacc (say the "first" one,
the easiest to reach from the axiom), and follow that path into lemon's
automaton.
> Again for sqlite3 grammar ignoring all precedences:
>
> lemon/byacc: 827 parsing conflicts, 788 shift/reduce, 39 reduce/reduce
>
> bison: 827 parsing conflicts, 734 shift/reduce, 93 reduce/reduce
That's funny. But then again, there is no unambiguous definition of "conflict"
that I aware of, and I know if will eventually revise Bison's way to count (as
mentioned in a previous message of mine).
> Now for cfront3 grammar:
>
> lemon: 19 parsing conflicts, 19 shift/reduce, 0 reduce/reduce
>
> byacc: 24 parsing conflicts, 21 shift/reduce, 3 reduce/reduce
>
> bison: 24 parsing conflicts, 20 shift/reduce, 4 reduce/reduce
I don't understand the 0 rr-conflicts. As above, we need to compare the
automata. Actually, if you can't include the grammars in your repo, you
probably can include at least the generated artifacts (grammars in various
syntaxes, and reports).
Have your tried the toy grammar of my previous message with lemon? Maybe that
would teach us something.
Cheers!