Hacker News new | ask | show | jobs
by kovrik 3149 days ago
That is awesome! Thanks!

Does anybody know the easiest way to compile to JVM bytecode? I have a Scheme interpreter written in Kotlin, what is the best way to compile it, instead of interpreting? Where do I start?

6 comments

Examples of Lisp-2 compiler using Java and ASM:

Shen to JVM bytecode compiler in Java 6 https://github.com/otabat/shen-jvm

Shen to JVM bytecode compiler in Java 8 with indy https://github.com/hraberg/Shen.java

The most widely used library for dynamic bytecode generation is asm: http://asm.ow2.org/
I was poking around* with this yesterday, has two different simple implementation of a lispkit compiler:

http://www.cs.ncl.ac.uk/publications/trs/papers/129.pdf

*by "poking around" I mean I typed the code into a text editor for further study:

code: https://pastebin.com/6pAkqE2R

Another alternative to jcdavis answer, is to just output bytecode in text format and use jasmin to compile it.

http://jasmin.sourceforge.net/

Or have a lookt at Kawa.

https://www.gnu.org/software/kawa/

Another possibility is using Truffle & Graal.
For one thing Clojure comes to mind: https://github.com/clojure/clojure