Monday, December 5, 2011

BicaVM: A JVM Implementation in JavaScript


Writing compilers/transpilers in JavaScript is all the rage right now.  It started with CoffeeScript and Objective-J, and quickly expanded to tons of existing and new languages, some of which are now listed on the AltJS website.  We’ve also seen projects like Emscripten, which takes LLVM bytecode and compiles it to JS.

In a similar spirit, we are given BicaVM, which is an implementation of the JVM in JavaScript.  It is still a bit incomplete, but it implements about 60% of the bytecodes available, so a good chunk.

This isn’t the first time we’ve seen a JVM implementation in JS though.  In 2008, John Resig wrote about Orto, another JVM implementation which has since disappeared from the web.  Luckily, someone else has put the source up on Github, so check that out as well.

This cross compilation of languages has spurred a lot of heated debate within the JS community.  In my opinion, JavaScript is not the be all end all language and it is awesome that we can enable more language choice within the browser without waiting for browsers to implement those languages themselves.  Another nice thing about transpiling in my opinion is that the developer gets to control which version of the language he uses rather than the browser, which makes backward and forward compatibility much nicer.

Source: BadassJS

No comments: