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)
My approach is to add various strawmen and have them translated to plain
javascript - transpiler approach.
I've been very happy with the ast it generates thus far.
(http://pegjs.majda.cz/)
________________________________
From: Brendan Eich <[email protected]>
To: Claus Reinke <[email protected]>
Cc: es-discuss <[email protected]>
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.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss