Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  JavaScript compiler for Erlang

Guest
Posted: Mon Jul 09, 2007 2:41 pm Reply with quote
Guest
Folks,

Is Erlang a good platform to compile JavaScript to?

Just gathering opinions.

Thanks, Joel

--
http://topdog.cc - EasyLanguage to C# compiler
http://wagerlabs.com - Blog





_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
rvirding
Posted: Tue Jul 10, 2007 11:16 pm Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
Joel Reymont wrote:
> Folks,
>
> Is Erlang a good platform to compile JavaScript to?
>
> Just gathering opinions.
>
> Thanks, Joel
>
> --
> http://topdog.cc - EasyLanguage to C# compiler
> http://wagerlabs.com - Blog

Yes, I think Erlang would be a good platform to compile JavaScript to. I
have been thinking about how to do a PHP implementation and arrived at
the same conclusion. The main difficulties would be the large libraires
and the rather crappy syntax and semantics (of PHP).

Robert
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
View user's profile Send private message Visit poster's website MSN Messenger
Guest
Posted: Wed Jul 11, 2007 10:20 am Reply with quote
Guest
What version(s) of the JavaScript/PHP would you guys target?


Guest
Posted: Thu Jul 12, 2007 12:37 am Reply with quote
Guest
Guest
Posted: Fri Jul 13, 2007 5:17 pm Reply with quote
Guest
I read Virding’s paper out of interest, and it is quite interesting, and I was playing around in my head how to implement Javascript in Erlang, when it struck me: why?
Guest
Posted: Fri Jul 13, 2007 5:40 pm Reply with quote
Guest
> 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
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
Guest
Posted: Fri Jul 13, 2007 6:24 pm Reply with quote
Guest
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: erlang-questions-bounces@erlang.org
[mailto:erlang-questions-bounces@erlang.org] On Behalf Of Charles Forsyth
Sent: Friday, July 13, 2007 12:40
To: erlang-questions@erlang.org
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
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
Guest
Posted: Fri Jul 13, 2007 6:55 pm Reply with quote
Guest
Maybe a JavaScript interpreter in Erlang would be more interesting? I know
of several XML-based languages requiring a JavaScript interpreter that could
benefit from being implemented in Erlang (VoiceXML, GrXML, CCXML, etc, all
in the speech-recognition industry).

Dominique

> 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...



_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
Guest
Posted: Fri Jul 13, 2007 7:44 pm Reply with quote
Guest
Gotcha.
Guest
Posted: Fri Jul 13, 2007 8:13 pm Reply with quote
Guest
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 Wink

Denis
2007/7/13, David Mercer <dmercer@gmail.com (dmercer@gmail.com)>:
Quote:
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.
Guest
Posted: Fri Jul 13, 2007 9:24 pm Reply with quote
Guest
It seems like it would be practical to allow users of a large Erlang
system to write things like business rules or game logic in
JavaScript... basically for the same reasons people use Rhino in Java.

I think compiling Erlang to JavaScript is less practical because
debugging JavaScript is hard enough as it is, since the VMs are all
broken in slightly different ways...

-bob

On 7/13/07, David Mercer <dmercer@gmail.com> wrote:
> 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: erlang-questions-bounces@erlang.org
> [mailto:erlang-questions-bounces@erlang.org] On Behalf Of Charles Forsyth
> Sent: Friday, July 13, 2007 12:40
> To: erlang-questions@erlang.org
> 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
> erlang-questions@erlang.org
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
rvirding
Posted: Fri Jul 13, 2007 11:18 pm Reply with quote
User Joined: 30 Aug 2006 Posts: 452 Location: Stockholm, Sweden
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". Smile

Robert

David Mercer wrote:
> Gotcha. Perfect explanation as to why. Now I can think on my drive
> home this evening
View user's profile Send private message Visit poster's website MSN Messenger
Guest
Posted: Fri Jul 13, 2007 11:19 pm Reply with quote
Guest
This is the reason I asked.

Think scalable web development for the masses.

In Javascript.

On top of Erlang.

On Jul 13, 2007, at 8:11 PM, denis wrote:

> 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.

--
http://topdog.cc - EasyLanguage to C# compiler
http://wagerlabs.com - Blog





_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
Guest
Posted: Mon Jul 16, 2007 8:38 am Reply with quote
Guest
I have on occasion thought that it would be fun to implement Javascript.

The idea of having lot's of little javascripts running in process and
message parsing
would be fun.

The first step would be a simple interpretor - from that the compiler
is easy Smile

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 now I wonder "how can I get a parse tree of some javascript" - Ideally
there would be a javascript-parser-in-javascript that produced a JSON
parse tree.

If such a parser exists please tell me where to find it !!

Failing this I guess the easiest approach is to take spidermonkey make
the stand-alone
version and fix the parser to dump the parse tree in some suitable
format. Unfortunately
I suspect that spidermonkey make C data structures suitable for
compiling/interpreting
rather than parse trees as such.

The next alternative would be to find a yacc grammar for javascript
and put this into yecc
but I suspect this would be out-of-sync with real javascript.

Failing that it's back to the ECMA-262 spec ( I suppose) and try to convert the
grammar in the appendices to something sensible.

In projects like this I always think that writing an accurate parser
is the tricky bit.

/Joe




On 7/14/07, Joel Reymont <joelr1@gmail.com> wrote:
> This is the reason I asked.
>
> Think scalable web development for the masses.
>
> In Javascript.
>
> On top of Erlang.
>
> On Jul 13, 2007, at 8:11 PM, denis wrote:
>
> > 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.
>
> --
> http://topdog.cc - EasyLanguage to C# compiler
> http://wagerlabs.com - Blog
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist
Guest
Posted: Mon Jul 16, 2007 9:39 am Reply with quote
Guest
I've been working with JS and Rhino quite a bit lately. As I see it,
there are 3 levels to making JS work:
- Core language and semantics
- Basic libraries (Array and the like)
- DOM

Rhino goes one step further and defines a so-called "LiveConnect"
feature (which is part of the ECMA standard) that allows bridging to
Java types.

To get JS on Erlang, first is to define a similar feature to bridge to
Erlang. Secondly, deal with some scary facts like there is only the
'Number' type in JS, and the language semantics makes it hard to
introduce different number types. Be prepared to cry.

All said and done, JS is a pretty powerful and cool language. Much
better than Java!

-ryan

On 7/16/07, Joe Armstrong <erlang@gmail.com> wrote:
> I have on occasion thought that it would be fun to implement Javascript.
>
> The idea of having lot's of little javascripts running in process and
> message parsing
> would be fun.
>
> The first step would be a simple interpretor - from that the compiler
> is easy Smile
>
> 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 now I wonder "how can I get a parse tree of some javascript" - Ideally
> there would be a javascript-parser-in-javascript that produced a JSON
> parse tree.
>
> If such a parser exists please tell me where to find it !!
>
> Failing this I guess the easiest approach is to take spidermonkey make
> the stand-alone
> version and fix the parser to dump the parse tree in some suitable
> format. Unfortunately
> I suspect that spidermonkey make C data structures suitable for
> compiling/interpreting
> rather than parse trees as such.
>
> The next alternative would be to find a yacc grammar for javascript
> and put this into yecc
> but I suspect this would be out-of-sync with real javascript.
>
> Failing that it's back to the ECMA-262 spec ( I suppose) and try to convert the
> grammar in the appendices to something sensible.
>
> In projects like this I always think that writing an accurate parser
> is the tricky bit.
>
> /Joe
>
>
>
>
> On 7/14/07, Joel Reymont <joelr1@gmail.com> wrote:
> > This is the reason I asked.
> >
> > Think scalable web development for the masses.
> >
> > In Javascript.
> >
> > On top of Erlang.
> >
> > On Jul 13, 2007, at 8:11 PM, denis wrote:
> >
> > > 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.
> >
> > --
> > http://topdog.cc - EasyLanguage to C# compiler
> > http://wagerlabs.com - Blog
> >
> >
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@erlang.org
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 2
Goto page 1, 2  Next
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum