Computer Science & Electrical Engineering

Compiler Construction – SMD163


Programming project


Instructions

Step 1

Step 2

Step 3


This step is simple to express: implement a type-checker for MiniJava according to the type system
definition you have developed as your fourth homework assignment. The distinct activities that
constitute this task are:

Step 4


Now we've come to the point when it's time to generate executable code for validated MiniJava
programs. This is the final mandatory step of the programming project, but it can be implemented
with varying levels of ambition:
  1. The basic option is to implement a code generator that corresponds to the E1 and S1
    schemes you have constructed as part of homework assignment 5. This implies using
    the stack for all intermediate values, and a very naive technique for implementing
    the conditionals in if- and while-statements.

  2. As a more refined, but still very basic attempt, the context sensitive compilation schemes
    branchTrue and branchFalse from lecture 10 (pp 47-53) can be added to the previous
    implementation to improve the handling of if and while conditionals.

  3. Add a simple register allocator for temporaries, by implementing the stack simulation
    described in the slides for lecture 10. Apart from that, this option is like no. 2 above.

Please note that the enumerated alternatives is a menu of choices, you are not supposed to complete
more than one of these tasks.

The Pentium-based server tau10.sm.luth.se is available for testing the output from your
compiler. The server is running Linux with your personal directories mounted, and you can log on
using your ordinary username and password.

A note regarding code generation: The Linux calling convention for the IA32 treats register ebx
as callee saves, and the others as the caller's responsibility. That means that your method prologue/
epilogue must push/pop ebx if it is used at all within the function. Other registers must be saved
during method calls only if their values are used after the call. For more information regarding
assembly language programming for IA32 under Linux, see this online book, in particular
appendices B, C and F.


The programming project will be reviewed all four steps at once after the deadline of March 10.
Deliverables consist of a written report and a demonstration of your implementation. The
purpose of the report is to make it easy for people outside your group to quickly grasp the
structure of your implementation, and identify the interesting design choices (see below).
Also, make sure to book a time for demonstration well in advance of the deadline, by
contacting one of the lecturers.

A successfully completed programming project is worth 2 academic points.



Some report writing guidelines:
The report should be sent in pdf format to email before midnight Friday March 9 2006.



The programming project should be carried out in pairs, or individually.

Oral discussion is good, copying files is not
!