0

I played a bit around with Compilers. And I want to compile my language into JVM Bytecode but I was wondering how I could write those Opcodes to a .class file.

Example:

I have my .atan src file and I want to compile this to a .class file. I can interpret this code but I do not know how to write those opcodes to the .class file. How can this be done?

John E.
  • 55
  • 1
  • 8
  • Related questions: https://stackoverflow.com/questions/7766291/how-to-generate-bytecode-and-save-to-class-file https://stackoverflow.com/questions/291492/which-library-program-can-be-used-to-generate-java-bytecode https://stackoverflow.com/questions/11677567/is-there-a-java-library-to-generate-class-files-from-an-ast https://stackoverflow.com/questions/8203139/any-java-bytecode-generation-guide – Thilo Sep 23 '17 at 09:26
  • A common (and useful) "trick" is to have your compiler output Java source code. Then you can use `javac` to create the class files. – Thilo Sep 23 '17 at 09:27
  • Hello world example to generate bytecode directly using ASM: https://stackoverflow.com/questions/5346908/generating-a-hello-world-class-with-the-java-asm-library – Thilo Sep 23 '17 at 09:28

0 Answers0