Re:Compiling to Java as a target language
by jarekr on Thursday April 14, 2011 @12:07PM
(#2447324)
It is easy if the language your compiler is written in is itself running on the JVM and you can access the nice libraries for generating the bytecode, for example ASM (http://asm.ow2.org/) which Clojure uses. I built a toy compiler for a Pascal-like language targeting JVM and conceptually it is easy (as you maybe meant), but generating binary bytecode "by hand" would require a lot of extra work. I took a look at ABCL source, it dedicates at least 100kb of Lisp code to a bytecode-generating library.
By the way, ABCL source code seems very interesting for anyone interested in compilers/interpreters/Lisp.
By the way, ABCL source code seems very interesting for anyone interested in compilers/interpreters/Lisp.