we’re writing some sort of compiler from Pascal to JVM Bytecode. And we’ve already implemented an expression tree generation, so the next step should be the creation of .class file. Can you suggest any guide/tutorial of how to generate any .class file at least from some static data? Because I’ve googled for 2 hours already and read JVM specification, but I really need some even simplest example to start developing the whole stuff.
we’re writing some sort of compiler from Pascal to JVM Bytecode . And we’ve
Share
Actually there is an example file inside ASM folder that you download. It’s called Helloworld and it’s located in
examplessubfolder. It shows how to compile (generate from scratch).classfile that corresponds to simple hello world app. It also shows how to get date from.classfiles but it’s another story.Maybe this is’n the best way, but when you need to start with java byte code generation and you need some basic examples it’s a good idea to have a look at ASM and the examples that are bundled within standard package.
Moreover Groovy uses ASM to generate its code 🙂