Hello, I was wondering which is the best way to extend Java syntax and include other things.
I mean something like Groovy or other langagues based upon Java, that keep backward compatibility
- The most efficient way should be to actually generate
.class
files without having to interpret them but letting the JVM do the dirty work. How can I achieve it? - Is there a way to let a partial compiler cooperate with the java one? Otherwise any kind of extension will need a compiler able to compile normal Java and also any other kind of synctatic sugar that I want to add.
- A cool thing would be to let the java compiler generate the code for normal Java syntax and include parts that are compiled indipendently (by generating opcodes) to replace new syntax things. For example, think about a new data type that should be a base one: it can be backened by a class and then used it in compiled bytecode, other parts of the code are compiled normally like Java would do.
What kind of tools are available for this purpose?
EDIT: I'm quite confident with compilers and VMs, I already wrote a bunch of them.. so I don't want an easy solution but the most efficient/functional one.. not limited to extending simple capabilities but extending as much as I want starting from a layer well thought to work out these things.