A simple compiler that can compile uGo to JVM instructions.
Implement a simple compiler that can compile micro Go to Java assembly code by Yacc, Lex. The generated code will then be translated to the Java bytecode by the Java assembler, Jasmin. The generated Java bytecode should be run by the Java Virtual Machine (JVM).
- Recommended OS: Ubuntu 18.04
- Install dependencies:
$ sudo apt install flex bison
- Java Virtual Machine (JVM):
$ sudo apt install default-jre
- Java Assembler (Jasmin) is included in the Compiler hw3 file.
generate an executable named mycompiler.
$ make
test.c
can be any other file.
generate the corresponding Java assembly code ( .j
file)
$ ./myparser < input.go
generate Main.class
.
$ java -jar jasmin.jar compiler_hw3.j
Run the Java program ( .class
file) with Java Virtual Machine (JVM).
$ java Main.class
You can see from the document.