I am writing a toy translator from REPL to Java. I would like to generate bytecode from the language and run it instead of interpreting AST and run it.
Since my Java is a little rusty, is it possible to run running bytecode on the fly on the JVM?
You can use java.lang.Classloader.defineClass (), which turns the bytecode into a class object. You can call newInstance () on the resulting class object and leave you.
Javassist, snippet, Java - , .