On 2022-09-22T15:54:31UTC Hans Åberg <haber...@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...

> 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?

-arne

Reply via email to