help-bison
[Top][All Lists]
Advanced

[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 09:53:39 +0200

> On 22 Sep 2022, at 08:30, Lukas Arsalan <cptarse-luke@yahoo.com> wrote:
> 
> Hi,
> 
> At 2022-09-22T07:08:55CEST Akim Demaille <akim@lrde.epita.fr> wrote:
>> This snippet is clearly ambiguous, since it allows two different parses of 
>> -1, which -Wcex nicely showed.
>> 
> yes. right.
> 
>> If I were you, I would handle this in the scanner.  IOW, the scanner should 
>> be extended to support signed literals, and > process that initial `-`.
>> 
> uhm... is that possible?
> e. g.:
> [1] -1 --> "num"
> [2] 1-2 --> "num" "-" "num"
> [3] (-1^-2) --> "(" "num" "^" "num" ")"
> [4] 1--2 --> "num" "-" "num"
> [5] 1---3 --> "num" "-" "-" "num"
> [6] 1-2^3 --> "num" "-" "num" "^" "num"
> I do not think that it is possible, to do that with regular expressions...

I think it is not possible, so therefore one expects -2⁴ to be parsed as -(2⁴).





reply via email to

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