Tue Jul 17 09:20:47 CEST 2007
Thanks - I found the narcissus code.
Then I built the stand-alone version of spidermonkey - and tried to load the
narcissus code into the stand-alone spidermoney and ... nothing
happened. It just
sat staring at me like an underfed cat and refused to purr.
This is neat code and not the kind of stuff you write after having read the
first few chapters of the Dragon book. It's a mix of a lexer, a
recursive descent parser
and a operator precedence parser - all rolled together into a single file.
Since it's a meta-interpreter I've no idea if the code is even correct
and if it computes
the same values as the embedded js interpreters.
So the problem of a parser still remains - I suspect the easiest way
is to make a library from spidermonkey and use the C parser, and hack
this to dump the parse tree in
a suitable form. Embedding spidermonkey in Erlang would have the added
making any new js interpreter/compiler easy to test - just by running
the same function in
the real interpreter and in the Erlang version.
On 7/16/07, Bob Ippolito <bob@REDACTED> wrote:
> On 7/16/07, Joe Armstrong <erlang@REDACTED> wrote:
> > 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.
> > parse tree.
> > If such a parser exists please tell me where to find it !!
> Take a look at Narcissus:
More information about the erlang-questions