[erlang-questions] JavaScript compiler for Erlang

denis dloutrein.lists@REDACTED
Tue Jul 17 00:51:46 CEST 2007


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

I started some time ago to convert the LR(1) given on mozilla website
(http://www.mozilla.org/js/language/grammar14.html) to a yeec one.
I also use robert's leex module for the scanner.
The problem is that my compiler courses are far away, so I resurrected my
"red dragon" book to refresh my memory.
I manage to parse a simple javascript file with a function declaration, and
produce the AST tree for that. Okay, nothing really astonishing :-)
I only roughly converted only a part of the grammar, and didn't managed the
{normal, initial} and {allowIn, noIn} grammar arguments for now. I resolved
one shift/reduce problem, but I'm not sure I did it the good way. That why I
have to revise my lessons on grammar, It's more a patch than anything else.


Denis 




More information about the erlang-questions mailing list