15-501 HOT Compilation
Spring 2008

Karl Crary
TR Noon - 1:20
Porter Hall 226B

Course Information

The course covers the implementation of compilers for higher-order typed languages such as ML. Topics include type checking, type directed compilation, elaboration, phase splitting, CPS conversion, closure conversion, allocation, and garbage collection. The course is disjoint from the standard compilers course (15-411); thus, topics such as parsing and code generation are not covered. Students will implement an ML compiler and runtime system as a term project.

Prerequisite: 15-312 Principles of Programming Languages (or equivalent)

There is no textbook for the course. Attendance in lectures is essential.

Announcements

May 8 Updated heap images for project 7 are available. The updated heap images include a parser and elaborator compatible with project 8. In particular, they accept the file test3a.sml.
May 1 A code fragment for elaborating fun bindings is available.
Apr 29 The final due date for all projects and project revisions is May 13.
Apr 29 The final project has been issued.
Apr 15 The seventh project has been issued. Despite the announcement made in class, it will be due April 29, not May 2.

Topics

Jan 15 F-omega
Jan 17 Typechecking for F-omega
Jan 24 Singleton kinds
Jan 31 Typechecking for Singleton kinds
Feb 5 Singleton elimination
Feb 7 Type-directed translation
Feb 12 Functorial inheritance (sample code: 1, 2, 3, 4, 5, 6)
Feb 19 CPS conversion
Feb 28 Closure conversion
Mar 4 Allocation
Mar 18 Garbage collection
Mar 25 Module type theory
Apr 3 Phase splitting
Apr 15 Elaboration

Projects

Students will complete several projects through which they will implement an ML compiler and runtime system.

Form of projects

For each project, students will be given a Standard ML signature to implement. The intended meaning of that signature will be made clear in class. Attendance in lectures is essential.

This signature to implement will be included in a collection of resource code that we will supply. Students should not modify any resource code. (Since projects will be graded using the original resource code, any modifications will likely result in project failure.)

On some occasions, we may supply some resource code in executable form, without supplying source code. We will do so by supplying an SML of New Jersey image extended with the relevant code.

Project submission

Students should submit their projects by concatenating their source code into a single file entitled project-<i>.sml, where <i> is the project number, and copying that file into /afs/andrew/course/15/501/submit/<userid>. (Exception: For Project 6, the file should be named gc.c.)

This file should not include the resource code that we supply.

Commenced projects

Project 1
Equivalence checking for F-omega + product kinds.
Implement Equiv : EQUIV.
[support code]

Project 2
Equivalence checking for singleton kinds.
Implement Equiv : EQUIV.
[support code]
Due February 14.
Must be complete by March 27.

Project 3
Singleton elimination.
Implement Singelim : SINGELIM.
[support code, Windows heap image (6MB), Linux heap image (6MB)]
Due February 26.

Project 4
CPS conversion.
Implement CpsConvert : CPS_CONVERT.
[support code, Windows heap image (6MB), Linux heap image (6MB)]
Due March 6.

Project 5
Closure conversion.
Implement ClosureConvert : CLOSURE_CONVERT.
Implement Hoist : HOIST.
[support code, Windows heap image (6MB), Linux heap image (6MB)]
Due March 25.

Project 6
Garbage collection.
Implement the function gc(), as described in README. Submit a file named gc.c.
[support code, Windows heap image (6MB), Linux heap image (6MB)]
Due April 8.

Project 7
Phase splitting.
Implement PhaseSplit : PHASE_SPLIT.
[
support code, Windows heap image (6MB), Linux heap image (6MB)]
Due April 29.

Project 8
Elaboration.
Implement Elaborate : ELABORATE.
[
support code, Windows heap image (6MB), Linux heap image (6MB), Fun binding code fragment]
Due May 13.

SML/NJ runtime binaries
Windows runtime
Linux runtime

Stress test sources
test1.sml
test2.sml
test3.sml
test3a.sml
gctest.sml, gctest.c

Grading

Grading is based on the number of successfully completed projects. For each project, students will submit their solution by the project's due date. On the due date, the projects will be graded automatically using a variety of test cases. If a student's solution passes all tests, the project will be marked as completed. If not, no score will be recorded and the student will have the opportunity to correct his/her solution. Students will be given a second-pass due date, by which they must submit their revised solution, which will be tested in a similar fashion to his/her original submission. This process continues until the project has been completed, or the course has ended.

The final due date for all projects and project revisions is May 13.

Students are urged not to try to exploit the system by turning in "token" submissions to procrastinate a project. This places students in the unfortunate position of having to complete several earlier projects during the busiest part of their semester. Therefore, token submission will not be accepted. If, in the judgement of the instructor, any submission does not represent a credible effort, the project will be marked as failed, and no further submissions for that project will be accepted.

It is expected that nearly all students will successfully complete all the projects and earn an A for the course.