CS445/CS545 Compiler Construction

SPRING 2006


COURSE INFORMATION
Instructor: Christino Tamon
Lectures: TR 9:30-10:45am Science Center 342
Office hours: Science Center 373 TR 8:30-9:30, 10:45-12:15
Pre-requisites: CS344, CS345.
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 (tentative) Assignments & Quizzes 50%; Midterm 20%; Final Exam 30%


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.

READINGS/NOTES (under construction)

ASSIGNMENTS
THE DRAGON PROJECT

The goal of the project is to build a compiler for a high-level programming language that outputs a low-level assembly program. This project will give us a chance to use knowledge from earlier (pre-requisite) courses and to acquire some new skills, such as:

SUBMISSION
Submit a full report (hardcopy) containing at least the following items: Submit the complete source listing (compressed tar file) via email.

PRESENTATION
During the last two weeks, schedule a meeting to present an online demonstration of the compiler. Be prepared for some extra testing and questions about your compiler project.

PROJECT DETAILS

Here are some blueprints for the Pascal part of the compiler project:

  1. Lex scanner & Yacc parser:
  2. Yacc parser + Symbol table:
  3. Semantic analyzer & Type checker:
  4. Code generator:
To synchronize this component of the project, make your compiler take a single input Pascal file (with suffix extension of ".p", say "main.p") and make it write the SPARC assembly output to file with the same name except for the suffix (which is changed to ".s", so "main.s"). We will then use GCC to produce the executable by running "gcc main.s". So if the compiler executable is called "mypc", then the following UNIX sequence should be used for testing all source files:
mypc main.p; gcc main.s; a.out


Enter the Dragon