4 ms·
I've had to do a lot of this recently for CodeCombat's transpiler, Aether: https://github.com/codecombat/aether https://github.com/codecombat/aether – it uses E
by nwinter 13y ago
I've had to do a lot of this recently for CodeCombat's transpiler, Aether: https://github.com/codecombat/aether https://github.com/codecombat/aether – it uses Esprima, Acorn, JSHint, and a bunch of other JS tools. There's a ton of great stuff out there, and it's easy to put them together since they all operate on the Mozilla SpiderMonkey Parser API abstract syntax tree format.
I like node-falafel better than estraverse, which is more concise to use: https://github.com/substack/node-falafel https://github.com/substack/node-falafel
If anyone likes this stuff and wants to write an open-source, in-browser parser from another language like Python, Haskell, or Ruby to the Mozilla AST format, we'd love to make it worth your while. See https://github.com/codecombat/codecombat/issues/72 https://github.com/codecombat/codecombat/issues/72 and then email me to work out an arrangement.
- anaphor 13y agoI just want to point out that parsing is the easy part of writing a language implementation. E.g. for Python all of the interesting stuff is in the VM and bytecode generator, the parser is just one page of a grammar that gets fed into a parser generator (for CPython). You will have a much harder time with Haskell since even more of the interesting stuff is done to the intermediate representation (ghcjs is the only thing I know of trying to run it in javascript).