[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to solve this reduce/reduce conflict?
From: |
Hans Åberg |
Subject: |
Re: how to solve this reduce/reduce conflict? |
Date: |
Thu, 22 Sep 2022 21:12:23 +0200 |
> On 22 Sep 2022, at 21:02, Lukas Arsalan <cptarse-luke@yahoo.com> wrote:
>
> On 2022-09-22T15:54:31UTC Hans Åberg <haberg-1@telia.com> wrote:
>> Context switches are best avoided unless absolutely necessary, in my
>> experience.
>> So if one designs ones own language, it might be good to try to avoid them
>> by a change in the grammar.
>>
> OK... I know that there are no signed numbers usually... But I wanted to try
> to change that...
> So for _me_ in "-2" the minus is a sign... And in "- 2" the minus is a unary
> inversion operator... And in "1-2" the minus is a subtraction operator (or
> an abbreviation for "1+-2" respectively (where the minus is a sign again))...
> This can all be done quite elegantly with this context trick in the ll-file...
I think the C/C++ interpretation with a unary operator and no signed integers
is the best one for arithmetic expressions. Having a sign as a prt of the numer
may be suitable in other contexts.
>> It might be confusing with -2^4 meaning (-2)^4, because in 1 - 2^4, it
>> should be 1 - (2^4),
>> and 1 -2^4 would be an error if two number cannot follow each other.
>>
> "1 -2^4" is no error in my program... it results in "-15".
> It even says, that "- 2^4" is "-16", while "-2^4" is "16". 🥳
>
> Do u think there will be any unwanted side effects?
In the minds of those interpreting it. :-)
- how to solve this reduce/reduce conflict?, Lukas Arsalan, 2022/09/21
- Re: how to solve this reduce/reduce conflict?, Akim Demaille, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Lukas Arsalan, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Hans Åberg, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Lukas Arsalan, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Hans Åberg, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Lukas Arsalan, 2022/09/22
- Re: how to solve this reduce/reduce conflict?,
Hans Åberg <=
- Re: how to solve this reduce/reduce conflict?, Derek Clegg, 2022/09/22
- Re: how to solve this reduce/reduce conflict?, Evan Lavelle, 2022/09/23
- Re: how to solve this reduce/reduce conflict?, AW, 2022/09/23
- Re: how to solve this reduce/reduce conflict?, lostbits, 2022/09/23