On this page:
Measuring run-times
Testing
Submitting
7.4

Project

There will be a final course project to be completed over the last several weeks of the course. The project will involve extending the design and implementation of the programming language and its compiler that we will develop throughout the semester.

The goal of this project is to put together everything you’ve learned over the semester to complete a full-featured compiler.

Project repository:

Slides from lecture on the project.

You are given a working compiler for an extension of the language we have been developing all semester.

Your overall object is to improve the run-time performance of code generated by your compiler while maintaining correctness.

There will be two releases of benchmark programs:

The final due date for your project is 10:30 AM on Saturday 12/14.

You will have an allowance of 10 minutes to compile all benchmark programs. Exceeding the allowance result in a penalty, but there is no reward for improving compile-time performance so long as you come in under the 10 minute mark.

You will have an allowance of 10 minutes to run all benchmark programs. For full-credit, you must improve the overall run-time performance by 20\%. Run-time will compute as the average of three runs, done on the GRACE cluster.

Full credit solutions will be entered in a compiler tournament to determine the most performant (and correct) compiler. Tournament results do not count toward your grade and will involve compiling programs not included in the benchmark suite.

Benchmark programs will be batch I/O programs: read some input, compute something, produce a result and/or write some output.

I/O primitives include read-char, write-char (limited to the standard input and output ports).

The compiler supports a standard library, with source level definitions provided to you. See the stdlib function in the compiler.

There will be a garbage collector provided by the second round of benchmarks which you will need to incorporate in to your compiler.

Measuring run-times

Let’s look at an example of how to measure the run-time performance of the code your compiler generates.

First, let’s start with fairly computationally intensive program. Here is a program that computes the nth prime number using the ancient Sieve of Eratosthenes method.

Save it to the directory where your compiler lives and run make sieve.run. This will run the compiler to generate the sieve.run executable. This program expects to read a number from the standard input port.

Run:

echo -n 100 | ./sieve.run

to compute the 100th prime number.

To measure the time it takes, add the time command:

echo -n 100 | time ./sieve.run

This will run the program and show the result and timing information. We will be concerned with improving the real time it takes to run the program.

Testing

There is separate a repository for tests. When you push your code, Travis will automatically run your code against the tests. If you would like to run the tests locally, clone the following repository into the directory that contains your compiler and run raco test . to test everything:

https://github.com/cmsc430/fp-test.git

This repository will evolve as the week goes on, but any time there’s a significant update it will be announced on Piazza.

Submitting

Pushing your local repository to github “submits” your work. We will grade the latest submission that occurs before the deadline.