Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Programming News

JavaScript JVM Runs Java 234

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."
This discussion has been archived. No new comments can be posted.

JavaScript JVM Runs Java

Comments Filter:
  • Re:Javaception (Score:5, Informative)

    by linuxgeek64 ( 1246964 ) on Monday November 21, 2011 @01:54AM (#38121460)
    It doesn't implement that much of the standard JVM.
  • Re:Javaception (Score:3, Informative)

    by cb88 ( 1410145 ) on Monday November 21, 2011 @02:24AM (#38121582)
    Sun already did that with HotJava it supported javascript.
  • Re:Not A New Concept (Score:4, Informative)

    by afabbro ( 33948 ) on Monday November 21, 2011 @02:36AM (#38121622) Homepage

    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.

  • Really? (Score:5, Informative)

    by aglider ( 2435074 ) on Monday November 21, 2011 @03:45AM (#38121826) Homepage

    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.

  • Re:Why now? (Score:5, Informative)

    by sydneyfong ( 410107 ) on Monday November 21, 2011 @05:43AM (#38122208) Homepage Journal

    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.

  • by Anonymous Coward on Monday November 21, 2011 @06:26AM (#38122368)
    Dammit, Fabrice Bellard keeps making me feel like I am as dumb as a plate of chicken.
  • Re:Not A New Concept (Score:5, Informative)

    by TheRaven64 ( 641858 ) on Monday November 21, 2011 @06:53AM (#38122432) Journal
    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...)

On the eighth day, God created FORTRAN.

Working...