Hello, JavaScript is going to be an important programming language to support. A year ago, Steve was working on an implementation of it called JANET. JANET compiled Javascript code to C#, and the runs the resulting code.
He is unable to continue this work at this point, but has written a lot of code, I have included his e-mail and his current snapshot of the code to this message, hoping that someone might be interested in completing this compiler. I would like to see this compiler use Reflection.Emit to generate code because it would allow us to use it as an embeddable scripting engine, and would allow us to implement "eval". In fact, Rachel's MonoLOGO compiler has moved into this direction as well: the compiler is part of the supporting runtime for the language. Miguel
--- Begin Message ---At 4:09 PM -0400 7/18/02, Miguel de Icaza wrote: > Last year, I spent some time writing a JavaScript compiler in > C#. I eventually dropped the project, partly due to a profound > lack of outside interest. However, I got pretty far -- I have a > working compiler that handles most of the ECMAScript 3 > language, and have implemented most of the core object model. > This is an implementation from scratch, not a port of Rhino, but > it might be useful to you. I'd be happy to send you a copy of > the code and give you details as to its current status. The > current implementation compiles JavaScript to C# source code, > but the code generator is well isolated behind a set of > interfaces, and it should be easy to add direct-to-CIL support. > >Oh. I am really interested in looking at this code if you still have it >around. No problem. The code is attached. I haven't looked at it in a while, but it ought to be in good shape. Let me know if you have any problems. The archive contains the C# source for the compiler, and one large test file (about 800 lines) named "test.js". The test file exercises more-or-less all of the functionality that's been implemented so far, and passed without errors the last time I was working on this code. I never bothered to set up a makefile. The batch file build.bat builds the compiler, creating JCommand.exe. JCommand.exe takes one command-line parameter (the name of a JavaScript file), and sends the equivalent C# code to stdout. The batch file buildtest.bat compiles and runs test.js. I have to run right now, but I'm very happy to answer questions at length -- just let me know. If you're interested in working with this code, I can gather up my notes on exactly what is left to be done to achieve full ECMAScript 3 compliance. I would also be happy to keep working on the code, but I don't have the time right now to lead the project. -- Steve
%JANET.tar
Description: application/applefile--- End Message ---
JANET.tar
Description: Binary data
