Slashdot Mirror


JavaScript JVM Runs Java

mikejuk writes "The world of software is made slightly crazy because of the huge flexibility within any computer language. Once you have absorbed the idea of a compiler written in the language it compiles, what else is there left to gawp at? But... a Java Virtual Machine JVM written in JavaScript seems like another level of insanity. A lone coder, Artur Ventura, has implemented a large part of the standard JVM using JavaScript and you can check the code out on Github. Notice this isn't a Java to JavaScript translator but a real JVM that runs byte code. This means it could run any language that compiles to byte code." Bonus: on Ventura's website is a set of visual notes from a talk he gave titled "My Language Is Better Than Yours."

7 of 234 comments (clear)

  1. Re:Javaception by linuxgeek64 · · Score: 5, Informative

    It doesn't implement that much of the standard JVM.

  2. Re:Javaception by cb88 · · Score: 3, Informative

    Sun already did that with HotJava it supported javascript.

  3. Re:Not A New Concept by afabbro · · Score: 3, Informative

    Forty years ago, a major software system for operating unmanned space satellites for the U.S. Air Force was written in a language called JOVIAL J4. The JOVIAL J4 compiler was itself written in JOVIAL J4.

    Hardly unusual. GCC is written in C.

    This is not quite the same thing.

    --
    Advice: on VPS providers
  4. Really? by aglider · · Score: 5, Informative

    This

    This means it could run any language that compiles to byte code.

    shoud read as
      This means it could run any language that compiles to Java byte code.

    --
    Sent as ripples into the electromagnetic field. No single photon has been harmed in the process.
  5. Re:Why now? by sydneyfong · · Score: 4, Informative

    Javascript speeds have increased greatly due to the reheated competition by browser vendors (it wasn't too long ago that the only thing really existed was IE6). Thus in the past 10 years, nobody in their right mind would expect a x86 emulator, a JVM etc. to be implementable in Javascript at tolerable speed.

    In fact, few expect these "discoveries" to happen so soon and so quickly, but since somebody proved it possible to do crazy things on Javascript, everyone with too much time on their hands are jumping on board and having fun with these projects.

    --
    Don't quote me on this.
  6. Re:This is completely unnecessary. by Anonymous Coward · · Score: 3, Informative

    Dammit, Fabrice Bellard keeps making me feel like I am as dumb as a plate of chicken.

  7. Re:Not A New Concept by TheRaven64 · · Score: 4, Informative

    Most compilers work like that. The Java compiler is written in Java (as you discover when it crashes and you get a Java stack trace). Smalltalk was written in Smalltalk and even modern Smalltalk implementations like Pharo are written in Smalltalk. The typical trick is to write a small compiler for a subset of the language in another language and then use it to compile the rest of the compiler. For example, the core of the Squeak VM is written in a subset of Smalltalk that is fairly easy to translate to C. This is then translated to C and compiled with the target system's C compiler. You then have enough of the VM running for it to load the rest. Early Pascal compilers did the same. In the '70s, having the compiler written in the language was considered a test of whether something was a 'real' language (since then we've learned that languages that are good for writing compilers are not necessarily good for other things. Well, some of us have...)

    --
    I am TheRaven on Soylent News