There's my crappy transpiler: https://github.com/joeedh/fairmotion/tree/master/tools/extjs_cc
Which uses a parser generator (and yes, the standard is quite helpful in pointing out ways to make JS work in a bottom-up grammar). The grammar is inline with the code, so I've extracted it and attached it to this email. Note that I've extended the grammar a bit, mostly to implement a type annotation system but there are a few other non-standard things as well (I still need to replace my python-style multiline strings with template strings, for example). The grammar is also a bit messy. I believe the only thing I'm missing is template strings and some of the new numeric literal stuff (e.g. binary literals). I just recently added a bunch of stuff in preparation to move my codebase to a different transpiler (one I don't have to maintain myself). Oh, and I think I'm missing yield assignments in generators (e.g. var x = yield y), too. Also, I'm not sure if arrow functions work in all cases, I have an ambiguity in my grammar there (which I don't feel like debugging because I'm switching to babel :) ). The regular expression stuff is kindof interesting; figuring out how to parse RE literals wasn't easy (it's not strictly possible to parse them with a RE tokenizer, but I managed to hackishly make it work). Joe On Thu, May 7, 2015 at 8:37 AM, Park, Daejun <[email protected]> wrote: > Hi, > > Is there any parser for ES6? It seems that no implementation completely > supports ES6 yet (http://kangax.github.io/compat-table/es6/), and I'm > just curious to see if there is at least a parser supporting all the > features of ES6. For example, the grammar given in the spec seems to be fit > to a parser generator, and I wonder if the grammar has been mechanized in > such a parser generator or is just a written spec. > > Best, > Daejun > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
grammar
Description: Binary data
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

