Announcements
- Grading for the course:
- Final Exam: 30%
- 3 quizzes (1 hr each,
take home): 13% each (total of 39%)
- Homeworks: 31%
- Important Dates:
- Sep 6: First day of class
- Dec 1: Last day of class
- Sep 27-29: Quiz #1
(Topics: 1 and 2 from Syllabus below)
- Nov 1-3: Quiz #2 (Topics: 3, 4 from Syllabus below)
- Nov 22-24: Quiz #3
(Topics: 5, 6, 7, 8 from Syllabus below, plus generation of
MIPSor similar target) - Final Exam: Dec 12, 3:30-6:30pm, AQ 4125
- Nov 11:
Remembrance Day
(no classes)
- Location of data files and
software packages:
~anoop/cmpt379/on fraser.sfu.ca and CSIL machines - Tue, Jun 14, 2005: Course web page created
- Tue, Sep 27, 2005: Take home Quiz #1 handed out. Due back at start of class on Thu, Sep 29th.
- Wed, Sep 28, 2005: Decaf language specification version 1 posted.
- Fri, Nov 4, 2005: Introduction to MIPS assembly language and the spim simulator posted.
Assignments
- Homework #1. Distributed on Tue, Sep
13, Due on Tue, Sep 20. Files are in
~anoop/cmpt379/hw1 - Homework #2. Distributed on Tue, Sep 20,
Due on Tue, Sep 27. Files are in
~anoop/cmpt379/hw2 - Homework #3. Distributed on Thu, Sep 27,
Due on Thu, Oct 6. Files are in
~anoop/cmpt379/hw3- You will need to refer to the Decaf language specification
- Homework #4. Distributed on Tue, Oct 11,
Due on Tue, Oct 25. Files are in
~anoop/cmpt379/hw4 - Homework #5. Distributed on Tue, Oct 25,
Due on Tue, Nov 8. Files are in
~anoop/cmpt379/hw5 - Homework #6. Distributed on Tue, Nov 8,
Due on Tue, Nov 15. Files are in
~anoop/cmpt379/hw6 - MIPS assembly and
spimdocumentation - The
spimsimulator is installed in~anoop/cmpt379/spim.linux - Homework #7. Distributed on Tue, Nov 8,
Due on Thu, Nov 24. Files are in
~anoop/cmpt379/hw7 - 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
- Textbook:
- Compilers: Principles, Techniques and Tools,
A.V. Aho, R. Sethi, and J.D.
Ullman, Addison-Wesley, 1986. ISBN: 0201100886
- Only for review:
- Sipser refers to Introduction to the Theory of Computation by Michael Sipser. 1996, PWS Pub. Co. ISBN: 053494728X
- Reference Textbooks:
Material that I use from time to time, but not required reading for
those taking the course.
- Modern Compiler
Implementation in {C,ML,Java} by Andrew W. Appel. 2002,
Cambridge Univ Press.
- Theory of Parsing, Translation and Compiling (Vol 1: Parsing and Vol 2: Compiling) by A. V. Aho and J. D. Ullman. 1972-1973, Prentice Hall.
- Advanced Compiler Design and Implementation by Steven S. Muchnick. 1997, Morgan Kaufmann.
- Course materials: From Compilers courses taught at SFU and elsewhere. Typically I read and use materials from these courses for my lecture notes and for assignment ideas. I mention them here to acknowledge their work.
Syllabus and Readings
- Introduction to Compiler Design
- Chp 1
- Notes #1
- Code sample: duff-a.c
- Links: Reflections on Trusting Trust, Ken Thompson. CACM 27(8), pp. 761-763, 1984.
- Lexical Analysis
- Chp 3
- Notes #2
- Code sample: adhocScanner.c
- Links: Historical Perspective: FORTRAN I
- Links: Posix regular expression specification
- Links: Storing a sparse table. R. E. Tarjan and A. C. Yao. CACM 22(11), 1979.
- Formal languages and automata, Analysis of Ambiguity
- Chp 0, 1 (Sipser)
- Notes #3
- Syntax Analysis, Deterministic Parsing and sub-classes of
CFGs
- Abstract Syntax Trees
- Chp 2, 2.5
- Notes #8
- Stack Frames and Parameter Passing
- Chp 7, 7.1-7.5
- Notes #9
- Syntax-directed Translation and Semantics
- Chp 5 and 6
- Notes #10
- Notes #11
- Code sample: funcptr.cc
- Translation to Intermediate Code
- Chp 8
- Notes #12
- Code Generation and Register Allocation
- Chp 9
- Notes #13
- Code sample: using-heap.mips
- Code sample: global-vars.mips
- Code sample: fact.decaf converted to mips-fact.mips versus gcc-fact.mips
- Code Optimization
- Chp 10, 10.1-10.4
- Notes #14
- Wrap-up
Course Expectations and Policies
- Students are expected to attend all classes: announcements about assigned readings, homeworks and exams will be made available at the start of each class. Such announcements may not be made on this web page, so don't rely on information here instead of attending class.
- Lecture notes or other materials put up on this web page are only additional material and not an alternative to the readings assigned. Only reading the lecture notes will not be enough to prepare for the assignments or the exams.
- Late assignments will be graded as follows: marks earned for assignments submitted after 11:45pm on the due date will be multiplied by a 0.8 penalty. Submissions two days late will get a penalty of 0.6 * grade, and any submission three days or more will be 0.4 * grade (Sat, Sun and holidays are included). Any submission identical to a solution key will get zero marks.
- If you must miss an exam because of illness, you are required to contact me prior to the exam either by email or a message in my mailbox. A valid note from a medical doctor is required specifying date of absence and reason. If you miss an exam due to valid medical reasons you will be graded on your performance on the rest of the course. Make up exams will not be given under any circumstances.
- Email policy: Use the prefix "cmpt-379: " on all your messages. If you do not include the prefix, then the mail might go unanswered. Do not send general questions about the class or the material to me directly. Instead use the class mailing list "cmpt-379 @ sfu.ca" to post your question.
- For personal advising come during my office hours (posted above).
- Copying on assignments or exams will be taken very seriously. If you are caught cheating on an assignment or an exam you will be hauled off for disciplinary action. There will be no assignments to be solved as a group. Despite this, students often meet to discuss the assignments. You have to be very careful that you do not take any notes or copy during these meetings.
- For more on academic dishonesty read the University code of academic honesty.
- I will give partial credit on exams. If you provide an incorrect answer but your work shows some understanding you will get partial credit, but if you have the correct answer, and your work shows a misunderstanding of the course material you will lose marks.
