[Haskell-cafe] ECMA262 (Javascript) interpreter

Fabian Bergmark fabian.bergmark at gmail.com
Tue Dec 9 06:06:29 UTC 2014


Yes I wrote my interpreter to support just this. In my use case the
host objects execute Haskell code in a monad YQLM (StateT YQL IO) and
this works fine.

2014-12-08 22:59 GMT+10:00 Tobias Dammers <tdammers at gmail.com>:
> I'm kind of fiddling with solving the same (almost) problem, but since
> you seem to have done most of the heavy lifting already, I'd like to
> know whether your implementation could fit my needs.
>
> Specifically, my use case is that I want to use JavaScript as a
> scripting language for a host application written in Haskell; this could
> be a game, or a CMS/blogging platform, or anything else that needs
> scripting; one of the must-have requirements is to parametrize the
> interpreter over arbitrary monads, such that it can be sandboxed into
> whatever monad stack you need to script over.
>
> On Sun, Dec 07, 2014 at 03:48:47PM +1000, Fabian Bergmark wrote:
>> 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
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
> --
> Tobias Dammers - tobias at twokings.nl - 070-3457628 - www.twokings.nl
> Maandag t/m donderdag van 9.00 tot 17.30
> Voor dringende vragen, mail naar support at twokings.nl


More information about the Haskell-Cafe mailing list