views:

309

answers:

4

I am writing an interpreter in Java for a domain-specific language with some scripting capabilities. I have already implemented a parser and now need to do a back end. To this end I am considering either to write my own interpreter (either working with abstract syntax trees or with some custom bytecodes) or target JVM (emit and execute Java bytecode at runtime).

Could someone with more experience in this area say how feasible is the approach of targeting JVM and what libraries would you recommend to use for emitting Java bytecode?

+11  A: 

I can suggest that you take a look at these libraries:

Bozho
Thanks for the links. Have you used any of these and which one would you recommend?
vitaut
I have used Javassist and CGLIB, but for way simpler tasks than your needs. One thing to note is that BCEL uses CGLIB, so perhaps it has bigger capabilities.
Bozho
+5  A: 

Check out Jetbrains MPS. Built by guys who brought us IDEA.

Peter Knego