Hi everyone,

While randomly entering expressions, I came across strange behavior in the 
parser. An unmatched left parentheses followed by certain parts of speech will 
not cause a syntax error. Instead, nothing will be printed:

   (++             NB. these all print nothing
   (@
   (@:
   (\\.
   ]a =.  1 + 2    NB. working correctly
3
   ]a =. (1 + 2    NB. prints nothing
   ]a =. (1 + 2 +  NB. errors
|syntax error
|   ]a=:(1+    2+

As you can see from the last example, though, syntax errors are still thrown 
when the expression on the right is invalid. But, if the expression on the 
right is valid, the left parentheses seems to "eat" it and cause the whole 
sentence to do nothing.

I don't know the internals of the parser, but the "trace" utility seems to 
confirm that something is wrong here:

   trace '(++'
 --------------- 6 Bident -----
 +
 +
 + +
|assertion failure: parse
|       *(mark+cavn,0)bwand>(<1 2;0){stack['stack must be empty or has a single 
noun, verb, adverb, or conj'

I hope this is helpful. J is a great language and I want to see it get even 
better.

Best,
Ryan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to