Milestone 3: Code Generation
In this milestone, you extend the MiniJava editor from the previous milestone to a MiniJava compiler, which is able to generate Java class files from MiniJava programs.
Jasmin is an assembler for the Java Virtual Machine. It takes ASCII descriptions of Java classes, written in a simple assembler-like syntax using the Java Virtual Machine instruction set. It converts them into binary Java class files, suitable for loading by a Java runtime system. Basically, Jasmin is a nice syntax for Java bytecode, with a compiler to actual Java bytecode in class files. A Spoofax implementation of Jasmin is available on GitHub.
We provide you with a Jasmin editor which was built with Spoofax. You can edit Jasmin files with a Spoofax editor. The editor’s menu entries allow you to inspect the abstract syntax of Jasmin files, to generate Java class files from them, and to execute those class files. Your initial project will contain several Jasmin example programs which you should explore in order to get used to Jasmin’s syntax.
We consider the following material to be useful for this milestone.
Lecture on Virtual Machines
In this lecture, we discussed the architecture of the JVM, some Java bytecode instructions, and different approaches to code generation in Spoofax.
Java Virtual Machine Specification
- The Stratego language is described in the Stratego language manual.
- Commonly used Stratego library strategies are described in the Stratego library manual.
- A complete listing of all strategies in the Stratego standard library can be found in the API documentation.
- There is also an experimental search engine for the Stratego standard library.