I would also recommend ASM, but have a look at Jasmin, I used it (or:, rather, had to use it) for ana university-project project, and it worksworked quite well,. I wrote a lexer/parse/-parser-analyzer/-optimizer/-generator combination for a programing-language language using javaJava and jasminJasmin, so it was generating JVM Code. I uploaded the code here ,; the interesting part should be the source-code code itself. In the folder "bytecode/InsanelyFastByteCodeCreator.java"bytecode/InsanelyFastByteCodeCreator.java, you find a picepiece of code which transforms an AST Tree into the input format of jasminJasmin assembler. IsIt is quite straight forwardstraightforward.
The source-language language (which was tranformedtransformed to the AST by Lexer+Parser+Analyzerthe lexer-parser-analyzer) is a subset of Java called MiniJava. It lacks some "complicated""complicated" features like Inheritanceinheritance, Constructorsconstructors, static methods, private fields/methods and methods. None of those features are difficult to implement, but there was another task to write an X86x86 backend (so to generate machine-assembler assembler), and those things tend to get difficult if you got no JVM which handles some of those things.
In case you wonder about the strange Classclass name: The task of the university project was to transform the AST into a aan SSA Graph (so a graph representingrepresenting the input code), then optimize the graph, and then turn the graphit into java byte codeJava bytecode. That was about 3/43⁄4 of the work of the project and the InsanlyFastByteCodeCreatorInsanlyFastByteCodeCreator was just a short-cut to test everything.
Have a look at the "Java"Java Virtual Machine"Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's Assembler; it’s quite helpful for understanding the JVM internals.
I would also recommend ASM, but have a look at Jasmin, I used it (or: had to use it) for an university-project, and it works quite well, I wrote a lexer/parse/analyzer/optimizer/generator combination for a programing-language using java and jasmin, so generating JVM Code. I uploaded the code here , the interesting part should be the source-code itself. In the folder "bytecode/InsanelyFastByteCodeCreator.java" you find a pice of code which transforms an AST Tree into the input format of jasmin assembler. Is quite straight forward.
The source-language (which was tranformed to the AST by Lexer+Parser+Analyzer) is a subset of Java called MiniJava. It lacks some "complicated" features like Inheritance, Constructors, static methods, private fields/methods. None of those features are difficult to implement, but there was another task to write an X86 backend (so to generate machine-assembler), and those things tend to get difficult if you got no JVM which handles some things.
In case you wonder about the strange Class name: The task of the university project was to transform the AST into a a SSA Graph (so a graph representing the input code), then optimize the graph and then turn the graph into java byte code. That was about 3/4 of the work of the project and the InsanlyFastByteCodeCreator was just a short-cut to test everything.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's quite helpful for understanding the JVM internals.
I would also recommend ASM, but have a look at Jasmin, I used it (or, rather, had to use it) for a university project, and it worked quite well. I wrote a lexer-parser-analyzer-optimizer-generator combination for a programing language using Java and Jasmin, so it was generating JVM Code. I uploaded the code here ; the interesting part should be the source code itself. In the folder bytecode/InsanelyFastByteCodeCreator.java, you find a piece of code which transforms an AST Tree into the input format of Jasmin assembler. It is quite straightforward.
The source language (which was transformed to the AST by the lexer-parser-analyzer) is a subset of Java called MiniJava. It lacks some "complicated" features like inheritance, constructors, static methods, private fields and methods. None of those features are difficult to implement, but there was another task to write an x86 backend (so to generate machine assembler), and those things tend to get difficult if you got no JVM which handles some of those things.
In case you wonder about the strange class name: The task of the university project was to transform the AST into an SSA Graph (representing the input code), optimize the graph, and then turn it into Java bytecode. That was about 3⁄4 of the work of the project and the InsanlyFastByteCodeCreator was just a short-cut to test everything.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin Assembler; it’s quite helpful for understanding the JVM internals.
- 32.1k
- 21
- 93
- 128
I would also recommend ASM, but have a look at Jasmin, I used it (or: had to use it) for an university-project, and it works quite well, I wrote a lexer/parse/analyzer/optimizer/generator combination for a programing-language using java and jasmin, so generating JVM Code. I can uploaduploaded the source socode here , the interesting part should be the source-code itself . In the folder "bytecode/InsanelyFastByteCodeCreator.java" you can havefind a look at itpice of code which transforms an AST Tree into the input format of jasmin assembler. Is quite straight forward.
The source-language (which was tranformed to the AST by Lexer+Parser+Analyzer) is a subset of Java called MiniJava. It lacks some "complicated" features like Inheritance, Constructors, static methods, private fields/methods. None of those features are difficult to implement, but there was another task to write an X86 backend (so to generate machine-assembler), and those things tend to get difficult if you wantgot no JVM which handles some things.
In case you wonder about the strange Class name: The task of the university project was to transform the AST into a a SSA Graph (so a graph representing the input code), then optimize the graph and then turn the graph into java byte code. That was about 3/4 of the work of the project and the InsanlyFastByteCodeCreator was just a short-cut to test everything.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's quite helpful for understaningunderstanding the JVM internals.
I would also recommend ASM, but have a look at Jasmin, I used it (or: had to use it) for an university-project, and it works quite well, I wrote a lexer/parse/analyzer/optimizer/generator combination for a programing-language using java and jasmin, so generating JVM Code. I can upload the source so you can have a look at it if you want.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's quite helpful for understaning the JVM internals.
I would also recommend ASM, but have a look at Jasmin, I used it (or: had to use it) for an university-project, and it works quite well, I wrote a lexer/parse/analyzer/optimizer/generator combination for a programing-language using java and jasmin, so generating JVM Code. I uploaded the code here , the interesting part should be the source-code itself . In the folder "bytecode/InsanelyFastByteCodeCreator.java" you find a pice of code which transforms an AST Tree into the input format of jasmin assembler. Is quite straight forward.
The source-language (which was tranformed to the AST by Lexer+Parser+Analyzer) is a subset of Java called MiniJava. It lacks some "complicated" features like Inheritance, Constructors, static methods, private fields/methods. None of those features are difficult to implement, but there was another task to write an X86 backend (so to generate machine-assembler), and those things tend to get difficult if you got no JVM which handles some things.
In case you wonder about the strange Class name: The task of the university project was to transform the AST into a a SSA Graph (so a graph representing the input code), then optimize the graph and then turn the graph into java byte code. That was about 3/4 of the work of the project and the InsanlyFastByteCodeCreator was just a short-cut to test everything.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's quite helpful for understanding the JVM internals.
I would also recommend ASM, but have a look at Jasmin, I used it (or: had to use it) for an university-project, and it works quite well, I wrote a lexer/parse/analyzer/optimizer/generator combination for a programing-language using java and jasmin, so generating JVM Code. I can upload the source so you can have a look at it if you want.
Have a look at the "Java Virtual Machine" book from Jon Meyer and Troy Downing. This book heavily references the Jasmin-Assembler, it's quite helpful for understaning the JVM internals.