Implement unusual syntax rules in grammar
Igor V. Burago
iburago at gmail.com
Mon Aug 10 06:29:39 UTC 2009
On Sun, Aug 09, 2009 at 07:36:17AM -0400, Austin Hastings wrote:
> Maintain 'end' as a reserved word, so that it cannot be used as an
> identifier. Recognize it explicitly in if/for/while, and make it a
> 'term' in expressions. Rakudo does the same thing with 'self' in its
> grammar. You will need to process it specially anyway, to insert
> array-size lookup code, so you can afford to detect when it is not a
> part of an array, and attach an error.
Thank you for your helpful reply! Explicit matching was the key I missed.
> That doesn't seem very strange, except in the "1 -2" case. You might
> have to define your unary-negative as excluding whitespace, but then
> <expr> [ \s <expr>]* should work.
Of course. But how can I define unary operators as excluding whitespace only in expressions inside
an array constructor?
--
Igor V. Burago
More information about the parrot-dev
mailing list