I've just pushed my latest changes to the parser.
The parser is now self-applicable. In fact, the js2scm translator, which uses the parser, is now able to bootstrap itself on top of Gambit. Once bootstrapped, js2scm is a standalone executable program (i.e. no need for v8 anymore).
I'm not suggesting that we do away with v8 for our development work... The point is that the development of js2scm gave me a good idea of the runtime support that is needed to implement the compiler, and a better understanding of the runtime model. Note that js2scm is more portable than v8 (because the Gambit compiler compiles to C, which we could compile anywhere). This might come in handy.
There are no optimizations in js2scm (hash-tables everywhere, etc) so it runs about 20 times slower than v8. I'm surprised it is not slower (because something as innocuous as x.abc is translated to (table-ref (Object-ht x) "abc") so the Scheme code has to hash the string "abc" and search the hash-table of x, which is not cheap).
The bootstrapping process was very useful to discover some remaining bugs in the source (v8 does not flag misspelled variable names, but Gambit does). For that reason alone, it might be good to use js2scm (and/or jslint?) once in a while to eliminate such bugs.
Marc
Afficher les réponses par date