CSCE 531: Compiler Construction (Spring 2013)

Prerequisites: CSCE 240

Meeting time and venue: TTh 1530-1645 in SWGN 2A07 (overflow in multimedia room on the first floor, 1A20)

Instructor: Marco Valtorta
Office: Swearingen 3A55, 777-4641
Office Hours: MWF 11-noon, or by previous appointment.


Grading and Program Submission Policy

Reference materials:

  • Watt, David A. and Deryck F. Brown. Programming Language Processors in Java. Prentice-Hall, 2000 (required text). Supplementary materials from the author, including an errata list, are available.
  • We will use parts of this free online textbook by Thorben Mogensen of the Department of Computer Science at the University of Copenhagen (local copy).
  • Specific objectives of this course are that the students will be able to:

    Introductory lectures
    Lecture notes for Chapter 1
    Transcript of handwritten notes of 2013-01-17 lecture
    Lecture notes for Chapter 2
    Notes on Denotational Semantics
    More Notes on Denotational Semantics
    Transcript of handwritten notes of 2013-01-24 lecture
    Lecture notes for Chapter 3
    Transcript of my notes of Dr. Fenner's 2013-02-05 guest lecture on lexical analysis
    Transcript of handwritten notes of 2013-02-07 lecture on lexical analysis.
    Transcript of handwritten notes of 2013-02-12 lecture on lexical analysis: conversion of NFAs to DFAs.
    Lecture notes for Chapter 4
    Lecture notes for Lexical Analysis (part of Chapter 4)
    Transcript of handwritten notes of 2013-02-19 lecture, with correction of HW3 and minimization of the resulting DFA.
    Transcript of handwritten notes of 2013-02-21 lecture, with an example of the method of loop invariants.
    Transcript of handwritten notes of 2013-02-28 lecture, with a correction of the midterm of 2013-02-26.
    Lecture notes for Chapter 5
    Lecture notes for Chapter 6
    Lecture notes for Section 7 of Chapter 6
    Lecture notes for Chapter 7
    Transcript of handwritten notes of 2013-04-11 lecture, with comments on the term project and extra work for graduate and honors section credit (includes notes from 2013-04-02 and 2013-04-04 lectures).
    Transcript of handwritten notes of 2013-04-18 lecture on Lisp (including notes from 2013-04-16).
    Transcript of handwritten notes of 2013-04-23 lecture.

    Quizzes (In-Class Exercises)

    Topics for the midterm.
    Final exam from spring 2002.
    Topics and suggestions for the Final.

    Graduate Student Presentations

    Homework and Projects
    See lecture log for a more complete list, which includes assignments for which no handout was given. Assignments should be turned in on paper at the beginning of class in SWGN 2A07, except for APOGEE (Section 006) students, who should email their work.
    Points per assignment.
    Term Project (PR2): Exercises 9.6, 9.7, 9.8, 9.12(a), and 9.15 [W&B], due date to be determined. The term project requires you to modify the Triangle compiler. The source code for Triangle can be obtained directly from the authors at The project consists of exercises 9.6, 9.7, 9.8, 9.12(a) and 9.15 in the text- book. Teams of two students (i.e., pairs) are allowed. If you decide to do the project as a pair, please email the composition of your pair to the instructor. You must submit source code (in Java, of course). You should clearly mark with comments the code you wrote.
    The code will be compiled and run on a Windows machine using Eclipse. Please modify the code to use the following main method (properly formatted, of course):
    public static void main(String[] args) { boolean compiledOK; if (args.length != 1) { System.out.println("Usage: tc filename"); System.exit(1); } String sourceName = args[0]; compiledOK = compileProgram(sourceName, objectName, false, false); if(compiledOK) { String [] arg={"obj.tam"}; Disassembler.main(arg); Interpreter.main(arg); } }
    This will allow me to test your code more easily.
    The code above assumes that you imported the TAM package; otherwise, use TAM.Disassembler and TAM.Interpreter. It is very difficult to evaluate properly code that does not compile. Therefore, you may receive a grade of zero on parts of the term project that do not compile. The same holds for code that compiles but does not run at all. Submit your code as a zip archive using the departmental dropbox. Use the Term Project dropbox. Include instructions on how to compile and run your code. Include an example of use.
    Test cases for PR4 (tar archive) One of the cases for strings uses single quotes instead of double quotes. Please modify the test program to use double quotes.
    Grading policy and test cases for the term project.
    The due date for the term project (include extra work for graduate or honor credit) is Friday, April 26, 2013 at midnight.

    A brief guide to the Triangle language processor.

    Lecture Log

    The USC Blackboard has a site for this course.

    Some useful links: