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. We provide you with a Jasmin editor which was built with Spoofax.
- Choose Install New Software... from the Help menu.
- Use the JasminXT update site
http://download.spoofax.org/update/jasmin
in the Work with: text box. - Tick JasminXT and choose Next.
- Choose Next, accept the license agreement, and choose Finish.
- Wait for JasminXT to be installed and restart Eclipse.
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. The GitHub repo contains a number of example programs. You should explore them in order to get used to Jasmin's syntax.
- GitHub-Jasmin: https://github.com/metaborg/spoofax-jasmin (Jasmin Editor Project on GitHub)
- Jasmin: http://jasmin.sourceforge.net/ (Jasmin Home Page)
We consider the following material to be useful for this milestone.
In this lecture, we discussed the architecture of the JVM, some Java bytecode instructions, and different approaches to code generation in Spoofax.
<iframe src="http://www.slideshare.net/slideshow/embed_code/5257918?rel=0" width="597" height="486" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>Oracle provides an online version of the Java Virtual Machine Specification. Chapters 3, 4, and 6 are particular helpful for this milestone. Furthermore, you can find a comprehensive list of Java bytecode instructions in the English Wikipedia.
Many useful strategies from Stratego's standard library are documented in this API Documentation.