> On 22 Sep 2022, at 08:30, Lukas Arsalan <cptarse-l...@yahoo.com> wrote:
> 
> Hi,
> 
> At 2022-09-22T07:08:55CEST Akim Demaille <a...@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