[erlang-questions] integrating nodejs with erlang code

Joe Armstrong <>
Wed Apr 10 21:29:04 CEST 2013


Just to qualify my earlier remark. The first step in implementing any
language is the parser for that
language. This is usually one of the trickiest parts (except for LISP, and
forth :-) - the problem is most languages
are designed to be easy(ish) to write, which means they have horrible
grammars and a odd mix of
techniques to actually parse the stuff.

Getting a parse tree for real languages that accepts the entire language
(and not a subset) is pretty difficult.

The next bit - writing an interpretor for the abstract syntax is far easier
- and you'll often get a long way with a subset.

Cheers

/Joe


On Wed, Apr 10, 2013 at 9:07 PM, Henning Diedrich <>wrote:

> Maybe use that tip, Aman, if that's what Dave found to make sense.
>
> I understood Robert as half-ways joking. Implementing other languages in
> Erlang is what he does himself, for the fun of it. See LFE and Luerl.
>
> And Joe was illustrating the lesson that you should never optimize more
> than you need, what's more: not before you know what (more) you need.
>
> Henning
>
>
> On Apr 10, 2013, at 8:56 PM, Dave Smith <> wrote:
>
> There is "most efficient" and "pragmatic".
>
> My "pragmatic" suggestion would be to run nodejs as a port (e.g.
> open_port) and use stdio to interact with it. Then you can let Erlang
> supervise a pool of nodejs VMs. If you want to be fancy, you can implement
> a ping/pong protocol for detecting when the nodejs system has gone off the
> deep end chasing down endless chains of callbacks. :)
>
> I may or may not have had to do this recently. :)
>
> D.
>
>
> On Mon, Apr 8, 2013 at 9:37 AM, aman mangal <>wrote:
>
>>
>> Hi,
>>
>> What is the most efficient way to pass events/data from erlang processes
>> to nodejs and vice versa? Setting up a tcp socket may be slower or
>> inefficient. I was thinking of doing something native. Both erlang and
>> nodejs provide libraries(NIF) to call C functions but none of them provide
>> an efficient implementation for calling erlang/nodejs functions from C or
>> C++ as far as I know. Please suggest some ideas!
>>
>> Thanks in advance.
>>
>> Aman Mangal
>> 3rd year Undergraduate
>> Department of Computer Science & Engineering
>> IIT Bombay
>> www.cse.iitb.ac.in/~amanmangal
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130410/f7309918/attachment.html>


More information about the erlang-questions mailing list