[antlr-interest] JavaScript grammar
David Holroyd
dave at badgers-in-foil.co.uk
Tue Apr 1 08:20:59 PDT 2008
On Tue, Apr 01, 2008 at 03:41:27PM +0100, Chris Lambrou wrote:
> As for regular expression literals, I'm
> inclined to simply treat them as separate Regex tokens without any further
> treatment, and leave their analysis to a separate grammar. Interestingly
> enough, whilst the ECMAScript spec has a whole section on the composition of
> regular expression literals, it doesn't appear to incorporate them into the
> rest of the grammar - not that I could see, anyway. I think they can be
> included as an alternative in the literal rule, which then becomes
>
> literal : 'null' | 'true' | 'false' | StringLiteral | NumericLiteral | Regex
Regular expression literals are ambiguous with '/' (division) unless you
give ANTLR a hand to work out what's what. Some discussion here,
http://www.antlr.org/wiki/display/ANTLR3/Island+Grammars+Under+Parser+Control
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list