bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/7] rule actions cannot be typed


From: Hans Åberg
Subject: Re: [PATCH 6/7] rule actions cannot be typed
Date: Sat, 11 Aug 2018 18:18:00 +0200


> On 11 Aug 2018, at 18:02, Akim Demaille <address@hidden> wrote:
> 
> 
> 
>> Le 5 août 2018 à 21:54, Hans Åberg <address@hidden> a écrit :
>> 
>> 
>>> On 5 Aug 2018, at 16:09, Akim Demaille <address@hidden> wrote:
>>> 
>>> Make sure that we cannot apply a type to the (main) action of a rule.
>> 
>> It might be retained, in case one wants to display it for clarity, say in a 
>> long grammar.
> 
> But then you have to make sure it’s consistent.

Right. For a typed non-terminal, it would suffice to do it at one place, or 
maybe %type, and others would be optional for clarity, but they must all be the 
same.

> Rici suggested a similar feature at the bottom of this message.
> 
> https://lists.gnu.org/archive/html/bug-bison/2018-06/msg00002.html
> 
> His suggestion is more ‘factored’: you’d do it once for the LHS
> of typically many rules, instead of doing it for each action.

I thought of that, but perhaps it is natural to put in on the actions, as one 
can split up the rules for the same LHS non-terminal rules into separate parts.

I have used it only a little, a modification of the C++ calculator for testing 
operator precedence grammars. There is a notation that might be used:

For terminals a, b, the meaning of a ⋖ b is to shift b, and a ⋗ b to reduce a 
and the top of the stack the tokens ≐ to it.

It does not recognize rules as such, but it might be possible to implement a 
variation of %precedence that specifies shift/reduce choices in the face of 
conflicts.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]