[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conflict-markers for shift-reduce conflicts similar to Lezer
From: |
Akim Demaille |
Subject: |
Re: Conflict-markers for shift-reduce conflicts similar to Lezer |
Date: |
Thu, 23 Jan 2020 18:07:00 +0100 |
> Le 21 janv. 2020 à 01:04, Adrian Vogelsgesang <address@hidden> a écrit :
>
> Hi,
Hi Adrian,
> I came across https://lezer.codemirror.net last week and I think they have a
> really good way of dealing with conflicts:
> In Lezer’s grammars, all conflicts must be marked with “ambiguity markers”.
> The concept is described on https://lezer.codemirror.net/docs/guide/,
> subsection “Allowing ambiguity”.
First time I hear about lezer. I don't know if their approach is unique, but
it's the first time I see it.
> I think this approach is superior to bison’s “%expect and %expect-rr
> modifiers on individual rules”
I don't think they address the problem of s/r conflicts. Their doc shows the
case of r/r conflicts only.
I had a similar idea, but somewhat different: using conflict identifiers on the
%expect-rr annotation of rules. I was about to post it, but it seems I forgot
to do it :( No-one had express interest in these annotations anyway
(https://lists.gnu.org/r/bison-patches/2018-11/msg00055.html).
> because:
> * the ambiguity markers specify at what exact position inside the rule the
> conflict occurs
> * using the ambiguity markers, it is exactly documented which positions
> conflict with which other rules, instead of only the number of conflicts
I agree counts are not a satisfying option. Yet I think that putting the
markers inside the rules themselves is too intrusive. It's much more accurate,
granted, but I felt that passing names to %expect-rr was enough.
> What do you think about this feature? Would something like this also be
> valuable for bison?
> How hard would it be to implement similar functionality in bison? (I have no
> clue about bison’s C-parts, yet…)
I have not evaluated how effort that would be. Especially the case where
position matters.