Should a new language compiler target the JVM?

Posted by Pindatjuh on Stack Overflow See other posts from Stack Overflow or by Pindatjuh
Published on 2010-06-02T18:28:43Z Indexed on 2010/06/02 18:44 UTC
Read the original article Hit count: 303

Filed under:
|
|

I'm developing a new language. My initial target was to compile to native x86 for the Windows platform, but now I am in doubt.

I've seen some new languages target the JVM (most notable Scala and Clojure). Ofcourse it's not possible to port every language easily to the JVM; to do so, it may lead to small changes to the language and it's design. So that's the reason behind this doubt, and thus this question:

Is targetting the JVM a good idea, when creating a compiler for a new language?
Or should I stick with x86?

  • I have experience in generating JVM bytecode.
  • Are there any workarounds to JVM's GC? The language has deterministic implicit memory management.
  • How to produce JIT-compatible bytecode, such that it will get the highest speedup? Is it similar to compiling for IA-32, such as the 4-1-1 muops pattern on Pentium?

I can imagine some advantages (please correct me if I'm wrong):

  • JVM bytecode is easier than x86.
  • Like x86 communicates with Windows, JVM communicates with the Java Foundation Classes. To provide I/O, Threading, GUI, etc.
  • Implementing "lightweight"-threads.I've seen a very clever implementation of this at http://www.malhar.net/sriram/kilim/.
  • Most advantages of the Java Runtime (portability, etc.)

The disadvantages, as I imagined, are:

  • Less freedom? On x86 it'll be more easy to create low-level constructs, while JVM has a higher level (more abstract) processor.
  • Most disadvantages of the Java Runtime (no native dynamic typing, etc.)

© Stack Overflow or respective owner

Related posts about compiler

Related posts about jvm