[erlang-questions] JavaScript compiler for Erlang

Robert Virding robert.virding@REDACTED
Mon Jun 25 12:17:28 CEST 2012

Sorry, sent this locally first time:

Running Javascript on the BEAM is not a trivial problem, not at least if you want to do it in pure erlang. The BEAM is specially targeted for Erlang and it is not a general purpose VM. It can do many things much more efficiently just because it IS a special purpose VM. The main is problem is that js has mutable data which the beam does not directly support, so it has to be be emulated. I have done a Lua implementation which has exactly the same problem. Doing global data does cost, unfortunately. I chose Lua as it was a simpler language but JS would be fun.

An alternative would be to use NIFs to try an emulate mutable data. You could not most likely not use the BEAM process heaps as destructive updates would seriously confuse the BEAM memory management. And if you start using NIFs then maybe it is better to connect to a "real" JS as is done in erlv8.

It really depends on how you would like to use JS.


----- Original Message -----
> On Thu, Jun 21, 2012 at 11:12:26AM -0400, Ingo Jaeckel wrote:
> }  Just out of curiosity: Do you want to compile JavaScript code to
> }  Erlang or Erlang to JavaScript?
> I want to run Javascript in the beam emulator.
> }  In either case - Why? What is the application behind this?
> At the moment I am working with VoiceXML which incorporates
> ECMAScript.
> Although they call a VoiceXML interpreter a "voice browser" if you
> consider where it is typically used in the network it is a server
> side
> application.
> }  What about https://github.com/beamjs/erlv8/ and
> http://beamjs.org/?
> Yes, there are a couple bindings to external engines.  Erlyjs was
> taking the approach I would prefer, interpreting the ECMAscript on
> the beam machine.
> --
> 	-Vance
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list