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."
So you could write a browser that supports JavaScript in Java, and then run the browser in itself?
... will be eventually written in JavaScript. ~ Atwood's Law (circa 2007)
Never trust a spiritual leader who cannot dance -- Mr. Miyagi
So we heard you like java...
...I heard you like Java in your script so I wrote you a JVM in Javascript so you can run Java while you're scripting.
Joking aside, this is not going to help the amount of confusion people have with regards to Java not being the same as Javascript *at all*.
The CB App. What's your 20?
I feel like that sort of bootstrapping is normal. GCC's written in C, afterall.
-Bucky
For years I've been saying that we need a DOM-Interface for byte code in Browsers and everytime I get downvoted. Nice to see people exploring in these directions now.
"we do need DOM-Bindings for Bytecode now more than ever. It would be so great to write code in a language of my choice and compile it to Browser-Bytecode with DOM-Bindings. This would make it possible to deliver more proprietary code without making browser-plugins or something similar."
"What we really need are DOM-Bindings for Bytecode. So you can use every language you want that is capable of compiling to bytecode and send it to a browser. This would make it easier for the developer and bytecode is easier and faster for the browser to execute."
Javascript != Java. "Javascript" is just a naming rip-off. So what's the big deal?
It's like writing a C compiler in Bourne shell. The point is less about the name than about the complexity and absurdity.
Advice: on VPS providers
... so I've put bloat in bloat, so you can wait while you wait.
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.
Fabrice Ballard already wrote an x86 emulator in javascript. Just install the standard x86 JVM inside of that and you're good to go.
Legit question from a programming novice: Why are all these discoveries coming up now? Hasn't JavaScript been around for 10+ years now? Is there something that has changed recently that makes people pursue these strange coding goals?
More like writing a Python interpreter in Perl. It'll work, but you'll feel a little dirty afterwards.
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
The JOVIAL J4 compiler was itself written in JOVIAL J4.
Want something really mind-blowing? PyPy is a Python interpreter written in Python. It includes a tracing JIT compiler to optimize hotspots as it runs to get about 5 times faster than the native C Python. I've used it and I still can't quite believe it.
Dewey, what part of this looks like authorities should be involved?
That's a byproduct of Perl. What you write has nothing to do with it.