Wednesday 15 May 2013

java - Dynamically creating .class file -


I defined a grammar through which I create a series of abstract syntax trees. For example,

 x = 7 println + x x 5  

becomes

 (assign) / \ x 7 (println). (+) / \ (*) 5 / x 2  

These trees are made from different nodes Classes representing values ​​and functions, now these trees Easy to interpret but my goal is to generate Java bytecode to represent these processes. My question is, what would be the best way out of that approach? Will I literally write differently in a classic file, or is there a library or interface that can help with these types of things?

The answer is yes. ASM and BCEEE are two Java libraries to assist with the making of runfile classes. Is designed.

No comments:

Post a Comment