CS445/CS545 Compiler Construction

SPRING 2009


COURSE INFORMATION
Instructor: Christino Tamon
Lectures: Tue-Thu 9:30-10:45am, Science Center 342 (or 334 ITL Lab)
Office hours: SC373, Tue-Thu 9:15-9:30,10:45-13:00
Pre-requisites: CS344 Data Structures and Algorithms, CS345 Automata Theory and Formal Languages
SYLLABUS: A study of compiler design. Overview of the compilation process. Formal definition of syntax, lexical scanning, parsing including LL and LR grammars, run-time structures, intermediate code generation, and storage allocation. Students are expected to develop a compiler for a substantial subset of a high-level language using compiler tools such as lex and yacc.

GRADING Project 50%; Exams 50%


TEXTS
OUTLINE
  1. Language translation. Compilation. Overview.
  2. Lexical Analysis. Regular expressions.
  3. Syntax Analysis. Theory of Parsing: top-down LL(1); bottom-up SLR(1), LR(1) (and LALR(1)).
  4. Semantic Analysis. Parse trees. Syntax-directed translation. Type checking.
  5. Code generation. Runtime environments.

OBJECTIVES/OUTCOMES
The objective of this course is to learn the fundamentals of compiler theory and its application in constructing a real working compiler. The specific outcomes are:
REQUIREMENTS/POLICIES
Although attendance is not mandatory, students are responsible for all course materials covered in lectures and any exams given during class periods. Students that need to make up missing course work must follow the official Clarkson policies regarding these matters. All students must submit their own work; the exchange of ideas are encouraged but ultimately the submitted work must be the student's own. Please refer to the Clarkson University Regulations for more guidelines on academic integrity and related matters.

SCHEDULE

DRAGON PROJECT

PROJECT CHECK LIST

Note: Bonus (optional for all), Team (required for groups of more than one), Grad (required for CS545)

(1.0) Lexical Analysis

  1. line numbering
  2. comments [style: (* .. *)]
  3. Bonus: allow two styles of comments [(* .. *) and {..}]
  4. Bonus: scientific notation for floating point values

(1.5) Syntax Analysis: grammar additions

  1. nested subprograms
  2. array access as both L-value and R-value
  3. Team/Grad: FOR statement

(2.0) Symbol Table

  1. Bonus: statistics of hashpjw
  2. Bonus: memory leak handler

(2.5) Syntax Tree (Intermediate Code Generation)

  1. visual print
  2. Bonus: memory leak handler

(3.0) Semantic Analysis

  1. Clear the check list
  2. error reporting
  3. Bonus: error recovery
Note: test files in /afs/cu/class/cs445/public/test-files/semantic-analysis/

(4.0) Code Generation

  1. Input/Output
  2. simple expressions (arithmetic and relational): gencode
  3. statements (assignment, conditional, loop)
  4. nonlocal names: base frame pointer (static scope parent)
  5. recursive routines (GCD test)
  6. Team/Grad: complex expressions (register spilling)
  7. Grad: arrays (L-value, R-value, parameters, nonlocal)
  8. Bonus: floating-point support
Note: test files in /afs/cu/class/cs445/public/test-files/code-generation/