CMPT-379 - Fall 2005 - Principles of Compiler Design

This course covers the fundamentals of compiler theory used to build compilers for high level programming languages. Algorithms used in building a compiler and their underlying theoretical foundations will be covered. We will cover each component of a compiler including lexical analysis, parsing, code generation, code optimization and type checking. As part of the course, students will implement a working compiler for a high level programming language.

More details: Course outline

Announcements

Assignments

  1. Homework #1. Distributed on Tue, Sep 13, Due on Tue, Sep 20. Files are in ~anoop/cmpt379/hw1
  2. Homework #2. Distributed on Tue, Sep 20, Due on Tue, Sep 27. Files are in ~anoop/cmpt379/hw2
  3. Homework #3. Distributed on Thu, Sep 27, Due on Thu, Oct 6. Files are in ~anoop/cmpt379/hw3
  4. Homework #4. Distributed on Tue, Oct 11, Due on Tue, Oct 25. Files are in ~anoop/cmpt379/hw4
  5. Homework #5. Distributed on Tue, Oct 25, Due on Tue, Nov 8. Files are in ~anoop/cmpt379/hw5
  6. Homework #6. Distributed on Tue, Nov 8, Due on Tue, Nov 15. Files are in ~anoop/cmpt379/hw6
  7. Homework #7. Distributed on Tue, Nov 8, Due on Thu, Nov 24. Files are in ~anoop/cmpt379/hw7
  8. Homework #8. Distributed on Thu, Nov 24, Due on Thu, Dec 8.

Important note on assignment submission and development: Your homework will be submitted electronically using the department-provided submission server. Connect to the submission server by going to the URL: https://submit.cs.sfu.ca/

It is expected that your program will compile and run using the standard gcc or g++ compiler on the Linux CSIL lab machines. If you are developing on a Linux or Windows machine at home, you have to ensure that the code will run on the CSIL machines before you submit the assignment. Please either visit the CSIL lab machines or you can use ssh to login to the CSIL Linux machines and also use scp to copy over and test your programs on the CSIL Linux machines before you submit them. Check the MTF Layout map for the machine names.

Note that the C++ compiler for gcc version 2.96 and gcc version 3.3.2 are seriously broken and will not be compatible with gcc on the CSIL machines. Check the version you are using by running the command gcc --version

For Windows machines, you might want to look into the use of the cygwin environment and the dos2unix command on Linux. There will be no extensions for problems with non-CSIL machines, so don't ask.

On some CSIL Linux machines, in some rare cases, you might have to extend your CPU time limit for a process. If you are using tcsh then run the command "limit cputime 1800" to extend CPU time to 1800 secs or 30 mins. If you are using bash then use the command "ulimit -t 1800".

The files for each homework are available in the directory ~anoop/cmpt379/. The directory is accessible only on the CSIL machines and on fraser.sfu.ca

Use a makefile to compile your program, and test and cleanup your program output. Two examples are provided: a simple one in ~anoop/cmpt379/hw1 and a more complex one in ~anoop/cmpt379/howto-make. In the directory howto-make try the commands make, make test, make clean and make tarball.

Textbook and References

Syllabus and Readings

  1. Introduction to Compiler Design
  2. Lexical Analysis
  3. Formal languages and automata, Analysis of Ambiguity
  4. Syntax Analysis, Deterministic Parsing and sub-classes of CFGs
  5. Abstract Syntax Trees
  6. Stack Frames and Parameter Passing
  7. Syntax-directed Translation and Semantics
  8. Translation to Intermediate Code
  9. Code Generation and Register Allocation
  10. Code Optimization
  11. Wrap-up

Course Expectations and Policies


anoop at cs.sfu.ca