erikd / language-javascript

Parser for JavaScript, in Haskell
BSD 3-Clause "New" or "Revised" License
160 stars 47 forks source link

Mozilla Parser API #32

Open mvcisback opened 10 years ago

mvcisback commented 10 years ago

Hey, it'd be really cool if this tool could emit json compatable with the Mozilla Parser API. Alot of tools conform to it, so it'd make hooking into them alot easier.

I believe it should be a (lossy) transformation on the AST implemented.

alanz commented 10 years ago

It looks interesting. Pull requests welcomed :)

mvcisback commented 10 years ago

I whipped up a prototype type specification yesterday: https://github.com/mvcisback/parser_api/blob/master/MozillaApi.hs

It's pretty heavily based on https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API with the omission of E4X stuff. I think there should be a pretty 1-1 transformation of that to the JSON SpiderMonkey and acorn (and a few other parsers) emit.

I imagine the conversion from to the more concrete syntax to the mozilla parser api might require abit of time for me to figure out, although it looks like showStripped does alot of what I will need.

achudnov commented 9 years ago

See also https://github.com/jswebtools/mozilla-js-parser-api, more tests, bug reports, pull requests are welcome.