15-417 HOT Compilation
Spring 2024

Karl Crary
TR 12:30 – 1:50
Wean 5312

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

Mar 28 The fifth project has been issued. It is due April 11.
Feb 27 The fourth project has been issued. It is due March 26.
Feb 20 The third project has been issued. It is due March 5.
Feb 6 The second project has been issued. It is due February 13.
Jan 25 The first project has been issued. It is due February 1.

Topics

Jan 16 F-omega
Jan 18 Typechecking for F-omega
Jan 23 Binding
Jan 30 Singleton kinds
Feb 6 Typechecking for singleton kinds
Feb 8 Type-directed translation
Feb 13 CPS conversion
Feb 20 Closure conversion
Feb 27 Allocation
Feb 29 Module type theory
Mar 21 Phase splitting
Mar 26 Garbage collection
Apr 2 Elaboration

Projects

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

Form of projects

For each project (except GC), 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 hand in their projects by concatenating their source code into a single file and submitting it to Gradescope. Unless otherwise indicated, that file should be named project.sml.

This file should not include the resource code that we supply. Also, this file should not contain diagnostic code; submissions should not print anything to console.

Commenced projects

Project 1
Equivalence checking for F-omega.
Implement Equiv : EQUIV.
[
support code]
Due February 1.

Project 2
Equivalence checking for singleton kinds.
Implement Equiv : EQUIV.
[
support code]
Due February 13.

Project 3
CPS conversion.
Implement CpsConvert : CPS_CONVERT.
[
support code, Windows heap image, Linux heap image, Mac heap image]
Due March 12.

Project 4
Closure conversion.
Implement ClosureConvert : CLOSURE_CONVERT.
Implement Hoist : HOIST.
[
support code, Windows heap image, Linux heap image, Mac heap image]
Due March 26.

Project 5
Phase splitting.
Implement PhaseSplit : PHASE_SPLIT.
[
support code, Windows heap image, Linux heap image, Mac heap image]
Due April 11.

SML/NJ runtime binaries
Windows runtime
Linux runtime

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. 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 6.

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.