[erlang-questions] JavaScript compiler for Erlang
Joe Armstrong
erlang@REDACTED
Mon Jul 16 10:35:49 CEST 2007
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 :-)
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@REDACTED> 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@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list