ES parsing tools (Re: Short Functions)
kamkasravi at yahoo.com
Sun May 29 17:37:29 PDT 2011
I've been experimenting with pegjs - which generates a parser based on the ecma-262 5th edition grammar.
I've been building a backend that walks the ast to regenerate the code (less white related formatting).
The nice thing about pegjs is most of the ast nodes agree with the parser api (https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
I've been very happy with the ast it generates thus far. (http://pegjs.majda.cz/)
From: Brendan Eich <brendan at mozilla.com>
To: Claus Reinke <claus.reinke at talk21.com>
Cc: es-discuss <es-discuss at mozilla.org>
Sent: Sunday, May 29, 2011 12:55 PM
Subject: Re: ES parsing tools (Re: Short Functions)
On May 29, 2011, at 12:21 PM, Brendan Eich wrote:
Mark and Tom already use Ometa at a code.google.com project, as noted. What more do you want?
>This does *not* address the issue of a usable spec grammar that can be validated (my point (a)). In spite of over a thousand words and many paragraphs in reply :-/.
To say a bit more, in a more positive tone: I agree that deterministic choice is attractive considered in a vacuum, to avoid ambiguities and better match how hand-crafted recusrive descent parsers are written. So PEG or stronger is plausible when experimenting, no argument there. Mark and Tom's choice to use Ometa for their language lab seems fine.
Recasting the ECMA-262 specification's unambiguous (after ASI, and assuming ES5 added no ambiguities to ES3) LR(1) grammar using a PEG could be tried and evaluated. I would be interested in seeing a no-other-changes translation of the spec grammar into a PEG that is validated somehow.
Here the issue is not validation against ambiguity, since the PEG is unambiguous because of ordered choice. The validation we'd need would be that both grammars produce sentences only and exactly in the same language.
es-discuss mailing list
es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss