[Nickle] bugs

Keith Packard nickle@nickle.org
Fri, 28 Feb 2003 16:12:22 -0800


Around 21 o'clock on Feb 28, "Ireland Peddlar" wrote:

> x!==x! is evaluated as x(!=)=x!
> According the the manual it should be evaluated (x!)==(x!)

> Also:
> It should be noted in the manual probably that
> ---x is evaluated as --(-x) instead of -(--x) and nickle chokes on it.
> especially since -++x is evaluated as -(++x) correctly.

These both stem from the separation of lexing from parsing.  I'll note that
GCC has the same trouble with ---x. The lexer picks off the leading '--'
as the decrement operator before finding the extra '-'.

K&R separate lexing from parsing in the C Reference Manual and state that
"the next token is taken to include the longest string of characters which
could possibly constitute a token". This means that the programmer must
ensure that each token is logically separate in the input stream, in this
case whitespace can be used to disambiguate between the two possible token 
streams.

-keith