Vincent Lefevre on Thu, 12 Sep 2024 16:43:34 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Supporting 2u |
On 2024-09-12 07:17:13 -0700, Ilya Zakharevich wrote: > On Mon, Aug 12, 2024 at 12:48:46PM +0200, Vincent Lefevre wrote: > > On 2024-08-12 12:04:36 +0200, Ruud H.G. van Tol wrote: > > > > P.S. IMO, 2u should better be parsed (as expected by the user!). > > > > > > Rather not. For example, 2e1 is already syntax, so can't also mean 2*e1. > > This does not stop other ambiguous syntaxes — like ++. AFAIK, it isn't ambiguous in GP/PARI, where "++" always means the increment postfix operator, even with a space: ? x+ + %1 = x + 1 (I'm wondering whether this is a bug.) So, this is an error: ? x + +1 *** syntax error, unexpected integer, expecting end of file: x++1 *** ^- But this can be confusing for C users: ? x + ++y %1 = x + (y + 1) which is actually (x++)+y. So, ? x + ++17 %2 = x + 19 ? 17 + ++y *** syntax error, unexpected ++, expecting end of file: 17+++y *** ^--- -- Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)