Code Generation Project

Software Systems
Advanced studies
This course is an optional independent course after the Compilers course. Students build a whole compiler in C# for a given object-oriented language. If a source program is found free from errors, the compiler generates bytecode (CIL) to be executed on a virtual machine.
Year Semester Date Period Language In charge
2014 autumn 01.09-12.12. 1-2 English Juha Vihavainen


The self-study course is an optional independent course, after the Compilers course. Students build a whole compiler for "MiniJava"-style language (with classes and inheritance). The implemented compiler generates executable code for the .NET virtual machine (an .exe assembly). The front-end parts of the compiler can be build using the techniques described in the preceding Compilers course. We have supporting Lecture materials (Spring 2012 ) on code generation for virtual machines, and about semantic analysis and transformations needed for object-oriented languages (mini-Java programs). The project is described on the Course Exercises Page (Spring 2012).

A standardized textual assembly language exists for bytecode, its assembler and disassembler being a part of Visual Studio. We can also directly generate dynamic methods or assemblies - at run-time, without going through symbolic assembly code. Other supporting tools include a bytecode verifier that checks off-line the validity of the produced code.
The projects are due at the end of the term. By default, the assignments are individual projects. There is no examination. The course gives 4 credit points.


Completing the course

You can register to this project in the normal manner via the Ilmo system. The project result is a Visual Studio solution that can be run on the machines of our department. Additionally a written report is required that documents the work and explains and motivates its solutions. The project work is done independently but some obligatory code inspection and demo sessions are required. These are separately scheduled, before the delivery of the work.

The first demo is after the front end (syntax and semantic analysis) is ready. A suitable date for this at the beginning of the 2nd study period (after 3rd November 2014). Please contact the course supervisor (Juha Vihavainen) when the compiler front end is done, so a meeting and a demo can be arranged. The project files (.sln) and documentation (.pdf) of the front end part should also be ready for inspection at this point.

The second demo is after the code generation part is finished. A suitable date for this at the end of the 2nd study period (after 8th December 2014). Again, there is no tight schedule but the essential parts of the documentation and software must be delivered for inspection before the meeting.

This same project will be arranged in Spring 2015. You will need to again enlist via Ilmo (so that credits can later be registered).