CS 367 Compilers
Spring 2009

Computer Science Department
The College of Arts and Sciences
Boston College

About Syllabus Textbook Compiler Project
Staff Resources Grading Problem Sets

Software

  1. Harper's Regular Expression Matcher;

Computers and Software

In this course, we will be using several software systems to develop a compiler for a variant of python. We will use the programming language ML (an acronym for "MetaLanguage") as our implementation language; we'll use the Emacs text editor as our development system and the subversion revision control system to manage the various files. Our compiler will generate native code for the MIPS architecture.

The software required for this course will be installed on the cslab system so you can do your work there. If you have your own computer, you will probably want to install all of the tools on your own computer --- they are all freely available on the internet.

The Implementation Language: ML

ML is a statically type, value-oriented programming language that is especially well-suited for compiler writing. (ML is usually referred to as a "functional" programming language but the adjective "functional" is a little misleading and doesn't really capture the basic idea behind this class of programming languages.)

There are two major dialects of ML: Caml and Standard ML. We will be using the Objective Caml variant of the Caml programming language. Don't be fooled by the "Objective" in "Objective Caml" --- we're using Objective Caml for its advanced module system and software tool suite. We won't be using the object system. An implementation of Objective Caml can be found on a server, yes, in France.
  • Objective Caml has an excellent User's Guide which should prove to be helpful in coming up to speed on programming in Objective Caml. It certainly deserves a bookmark.

  • There are a number of good tutorials on Objective Caml.

  • Jason Hickey has written a very good draft of a textbook on Objective Caml: An Introduction to Objective Caml.

The Editor: GNU Emacs

Emacs is an extensible and customizable text editor that has been kicking around the Unix community for about 30 years and has something of a cult following. An implementation of Emacs is available on the lab computers and is part of the standard linux and OS X distributions.

If you would like to use your own computer for this course but you do not have Emacs on your system, you can find numerous implementations for various platforms on the web. I recommend installing GNU Emacs. See me or Phil Temples if you have trouble with the installation.

If you are new to Emacs, run it from the command line and then take the built-in tutorial by typing "ESC x help-with-tutorial".

When the Emacs editor boots up, it looks for a file called .emacs in your home directory. This file contains initialization code (written in LISP). The LISP code provides hooks into Emacs which can be used to implement specialized "modes" for editting different languages. We will be using a customized mode for Caml called tuareg.

The code implementing tuareg-mode can be downloaded here. Follow the instructions in the README file to install it. See me if you need help with this step.

The Revision Control System: svn

Subversion is an open source revision control system which allows a group to establish a repository (file structure) on one system and synchronizes concurrent access by users from remote systems. The repository contains a master copy and each user "checks out" a local working copy of the master.

We will use svn for managing our files, for distributing support code and interfaces and for submitting work for grading. We will provide subversion repositories for each of you on the cslab system.

If you would like to use your own computer and it doesn't have subversion, you can freely download an implementation.

The svn Quick Reference Card may be worth a bookmark.

The Target Language: MIPS

Our compilers will target the MIPS architecture by emitting code in (a subset of) the MIPS assembly language. Most of you are probably familiar with this architecture from the Computer Organization course. The .asm files can be assembled and the resulting binary can be run on the MARS MIPS Simulator. Like all of the others, this system is freely available.

In addition to the MARS implementation, we will provide a MIPS virtual machine in Caml so you will be able to execute the code directly in Caml without needing to assemble and run it using MARS.

Getting Help

Developing a compiler is a major undertaking involving thousands of lines of code. It is especially daunting when using a new programming language for the implementation. I expect to spend a good deal of time with students helping track down bugs and working on design issues. I suggest working in groups in the CS office suite so you can stop in with questions.
Created on 01-01-2009 18:21.