A Small Grammar Issue with Classes

C. Scott Ananian ecmascript at cscott.net
Tue Dec 16 13:26:48 PST 2014


On Tue, Dec 16, 2014 at 4:15 PM, Kevin Smith <zenparsing at gmail.com> wrote:
>
> We cannot tell with just two tokens of lookahead whether we need to parse
> a concise method or a function declaration.
>
[...]

> Otherwise, are there any other parsing tricks which might help out?  (I'm
> not 100% sure what our constraints are with respect to lookahead or rewind.)
>

Um, use three tokens of lookahead?

It doesn't seem like this is actually an ambiguous grammar, but maybe I'm
missing something.

I can recommend both ANTLR and peg.js as robust solutions that can handle
arbitrary lookahead.
  --scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141216/d92bfdf3/attachment.html>


More information about the es-discuss mailing list