[Haskell-cafe] ECMA262 (Javascript) interpreter

Fabian Bergmark fabian.bergmark at gmail.com
Sun Dec 7 05:48:47 UTC 2014


I have been implementing an ECMA-262 (Javascript) interpreter over the
last few weeks. I have been following
http://www.ecma-international.org/ecma-262/5.1 and tried to keep my
implementation as close to the specification as possible.

The code can be found here https://github.com/fabianbergmark/ECMA-262

So far I have implemented the core language, but has yet to write all
the specification functions (Array.splice, String.substring etc.).
Before I do this and release it on hackage, I would appreciate
feedback on my implementation.

The issues I see at the time are:

* The parser is slow for deeply nested code
* Strict mode is not implemented
* Interpret.hs is ~ 6k lines
* SubType.hs uses IncoherentInstances, and a better implementation
would be nice. At the moment it works but for one case.

To test the code, install the cabal package and run ecma262 on a .js
file. One host object, console.log is provided and prints to stdout.

Fabian Bergmark


More information about the Haskell-Cafe mailing list