[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.
- [PATCH 0/7] RFC: typed midrule actions, Akim Demaille, 2018/08/05
- [PATCH 2/7] add support for typed mid-rule actions, Akim Demaille, 2018/08/05
- [PATCH 1/7] tests: make room for more cases, Akim Demaille, 2018/08/05
- [PATCH 4/7] tests: check typed mid-rule actions, Akim Demaille, 2018/08/05
- [PATCH 5/7] warn about typed mid-rule actions in Yacc mode, Akim Demaille, 2018/08/05
- [PATCH 6/7] rule actions cannot be typed, Akim Demaille, 2018/08/05
- [PATCH 3/7] regen, Akim Demaille, 2018/08/05
- [PATCH 7/7] NEWS: update, Akim Demaille, 2018/08/05