[erlang-questions] JavaScript compiler for Erlang

Robert Virding <>
Sat Jul 14 00:32:42 CEST 2007


Implementing languages is fun!

After doing Erlog (Prolog in and for Erlang), which you can find on 
trapexit, we were building a new webpage for our project at work and the 
platform we decided to use was written in PHP (as so many are). I then 
thought that if you wrote a PHP interpreter in Erlang then you could 
easily and efficiently integrate into Yaws for example and get the best 
of both worlds. So I started looking at PHP.

Now PHP sucks in many ways, the syntax for example is a right mess. But 
apart from that it doesn't seem too difficult. The main problem is 
probably doing all the libraries. PHP has one advantage in that you 
generate HTML so you don't really need any windowing interfaces.

I see now that perhaps I should start with Javascript. However, I have 
not really looked at the language but I can't imagine that there could 
any real problems.

I would say that it should not be too difficult to interpret/compile 
almost any language as long as it does have its own windowing interface. 
Whether it's really worth it is another question. But as I said 
"implementing languages is fun". :-)

Robert

David Mercer wrote:
> Gotcha.  Perfect explanation as to why.  Now I can think on my drive 
> home this evening…
> 
>  
> 
> David
> 
>  
> 
> ------------------------------------------------------------------------
> 
> *From:* denis [mailto:]
> *Sent:* Friday, July 13, 2007 14:12
> *To:* 
> *Cc:* 
> *Subject:* Re: [erlang-questions] JavaScript compiler for Erlang
> 
>  
> 
> I started thinking about compiling javascript into erlang one month ago, 
> as a possible need for a project in my company.
> 
> We are building an infrastructure allowing giving some services to our 
> users. But external developers (same company, but other teams) could 
> build their own custom services inside the infrastructure. Having these 
> new users to learn a new language to build a custom services (which can 
> be quite simple) can be badly perceived. Especially to some "average" 
> developers which even don't know what is a functional language; so when 
> you have to explain them that there is no for loops, that you can't 
> change the value of a variable... You see what I mean. I thought of 
> javascript because is syntax is quite similar to java and c++, and 
> because it can be quite powerful if you want to use advanced constructions.
> 
> Also, having done a lot of web development before, I remember that I was 
> fed up to switch from one language to another, when working on the 
> client or the server part, and not being able to share code. So for me, 
> having a platform able to use concurrency and distributing power of 
> Erlang, allowing me to use the same language for the client and server 
> side seems appealing.
> 
> But it's true that compiling javascript into erlang isn't 
> straighforward, which is intellectualy interesting and challenging ;-)
> 
> Denis
> 
>  
> 
> 2007/7/13, David Mercer < <mailto:>>:
> 
> True, it is quite annoying to have to code AJAX with event handlers as
> opposed to just writing code linearly as you would in Erlang.  That,
> however, would justify compiling Erlang to Javascript, instead of vice
> cersa, so you can write your code in Erlang but distribute it to 
> browsers in
> a language they understand.
> 
> So my question stands: other than for intellectual edification, why would
> you compile Javascript to Erlang?  I'm not asking rhetorically; I'm hoping
> the answer will cause me to think about it on my drive home this evening...
> 
> David
> 
> -----Original Message-----
> From:  
> <mailto:>
> [mailto: 
> <mailto:>] On Behalf Of Charles Forsyth
> Sent: Friday, July 13, 2007 12:40
> To:  <mailto:>
> Subject: Re: [erlang-questions] JavaScript compiler for Erlang
> 
>  > being said, since most Javascript development is done for the browser,
>  > concurrent programming isn't as big an issue for most Javascript
>  > programmers, ...
> 
> that's changing: most interactive environments are concurrent environments,
> although the support
> for it in Javascript seems dismal.  (but then, it's dismal in most windowing
> systems, too.)
> that seems to force slightly unusual approaches
> (but those might anyway be interesting in themselves), such as:
> 
> MapJAX: Data Structure Abstractions for Asynchronous Web Applications
> http://www.usenix.org/events/usenix07/tech/myers.html
> 
> _______________________________________________
> erlang-questions mailing list
>  <mailto:>
> http://www.erlang.org/mailman/listinfo/erlang-questions 
> <http://www.erlang.org/mailman/listinfo/erlang-questions>
> 
> _______________________________________________
> erlang-questions mailing list
>  <mailto:>
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list