[erlang-questions] JavaScript compiler for Erlang

David Mercer <>
Mon Jul 16 16:40:22 CEST 2007


Joe Armstrong wrote:
> The difficulty of wring an interpretor seems mainly to do with getting
> an accurate
> parse tree of the js source into Erlang - the interpretor should be pretty
easy.

So, for me, who is new to Erlang and thought about it on my drive home last
Friday, is this the right approach to the implementation: have a separate
process for each object and lexical environment.  An object is then
represented as a PID, and requests for properties and methods (which are
basically the same in Javascript), would send a message to the process,
which would return the appropriate value (which may also be an object/PID)
or function.  Nested lexical environments (e.g., with blocks, function
blocks, and the global environment), therefore, can send forward a request
to their higher level if the value is not found in their environment.

Am I on the right track?

Cheers,

David




More information about the erlang-questions mailing list