a tiny Lisp interpreter in Kotlin for exercise • But basically, interpreters aren’t so fast. So, I tried dynamically compiling Lisp code to Java byte code • Finally, I tried outputting those Java byte code to a JAR file
Java source code traversing the tree using Visitor pattern • Compile the Java source code using http://janino-compiler.github.io/janino/ • Extract the Java byte code with a bit hack • Create a JAR file from the byte code and dependent classes
of source files to a set of class files like JAVAC, but also compile a Java expression, block, class body or source file in memory, load the bytecode and execute it directly in the same JVM. Compile the Java source code
code • It’s really easy to dynamically compile Java source code and invoke it with Janino • But Janino doesn’t provide any API to get compiled Java byte code…
dependencies with internal Kotlin classes (e.g kotlin.KotlinNullPointerException). So the classes are needed to be included in a JAR file to avoid runtime failures.