Hacker News new | ask | show | jobs
by jarekr 5542 days ago
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.