I have defined a grammar through which I produce a series of abstract syntax trees of sorts. For example
x = 7 println + * x 2 5
becomes
(assign) / \ x 7 (println) | (+) / \ (*) 5 / \ x 2
These trees are made from various Node
classes representing values and operations. Now, these trees are easy to interpret but my goal is to generate Java bytecode representing these processes. My question is, what would be the best way to approach that? Should I just literally write various bytecode instructions to a .class file, or is there some library or interface that can help with this sort of thing?