[erlang-questions] JavaScript compiler for Erlang

Patrick D. Logan <>
Tue Jul 17 06:39:02 CEST 2007

> which develops a simple Pratt parser for a reasonable subset of javascript.

BTW someone (Joel? Joe?) suggested using JSON as the parse tree might be helpful.

The Pratt parser I just mentioned by Douglas Crawford parses Simplified Javascript into an almost-JSON parse tree. The difference is that the keys are symbols rather than strings. 

So it would be a trivial change to make the parse tree true JSON. Then a bootstrap would be fairly simple -- write the interpreter in Erlang  to take the parse tree in JSON and execute it.

Then writing a Pratt parser in Erlang would be unnecessary as Crawford's parser is itself written in Simplified Javascript. As long as the speed was acceptable.

Of course the next step would be to write a translator from the JSON parse tree into Erlang, and there'd be a Simplified Javascript *compiler* for Erlang.

More information about the erlang-questions mailing list