Page 1 of 1
+3 is not a number
Posted: Sun May 22, 2005 11:00 am
by ted
On 3/1/2005 Jose Ambros-Ingerson <
jose@kiubo.net> wrote:
I just discovered that
oc> a = +3
gives you a parse error.
Isn't this kind of strange?
Posted: Sun May 22, 2005 11:01 am
by ted
On 3/1/2005 Michael Hines <
michael.hines@yale.edu> wrote:
Well, now that you mention it... What do you think of this:
All this is defined in the nrn/src/oc/parse.y where
Code: Select all
%left '+' '-' /* left associative, same precedence */
%left '*' '/' '%' /* left assoc., higher precedence */
%left UNARYMINUS NOT
%right '^' /* exponentiation */
...
expr: NUMBER
...
| '-' expr %prec UNARYMINUS
{ TPD; $$ = $2; code(negate); PN;}
I suppose it would be possible to add a UNARYPLUS.
Then you could write things like
I see from the above that
also is valid.