require-hm icon indicating copy to clipboard operation
require-hm copied to clipboard

Parsing for harmony modules

Open paulirish opened this issue 13 years ago • 1 comments

(Don't know what's left for this effort but just wanted to cross-link this...)

http://code.google.com/p/esprima/issues/list?can=1&q=Spec%3DHarmony

cc @JamesMGreene

paulirish avatar Apr 20 '12 20:04 paulirish

Great, been meaning to look at esprima. I was also thinking of using the lower level parser items from narcissus, with the hopes that I could get destructuring support enough to do the import {} translation to old timey JS, and just wedge in the module and import keywords if there was not a narcissus branch that had them.

Looks like destructuring in esprima is still under development.

So what's left:

  • Integrate a parser instead of the hacky regexps.
  • Update to latest thinking on the syntax. For me, it is just small massages on what is supported now in this repo.

The plain module Foo {} syntax may not be supported, unless there is just one module in the file (treat it as a named foo module), but it should support the wrapperless modules (like commonjs modules) that use module/import to reference other code.

Also, the ModuleLoader part of the ES spec is not supported in this, just the new static syntax. A shim for the basic ModuleLoader API could be provided, but I would treat that as a second iteration sort of thing.

jrburke avatar Apr 20 '12 21:04 jrburke