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?
+3 is not a number
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
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
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.
Well, now that you mention it... What do you think of this:
Code: Select all
oc>---4
-4
oc>----4
4
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;}
Then you could write things like
Code: Select all
---+-+++-4
Code: Select all
!!!!4