CS 2210 Compiler Design

Spring Term: 2134

 

 

Class

Time:

4:30 PM – 5:45 PM

Days:

MW

Room:

6516 SENSQ

Webpage:

http://www.cs.pitt.edu/~jmisurda/teaching/cs2210.htm

Contact Information

 

Instructor: Jonathan Misurda

 

TA: Yingze Wang

Office:

6203 SENSQ

 

Office:

6508 SENSQ

Email:

jmisurda@cs.pitt.edu

 

Email:

yingzewang@cs.pitt.edu

Office Hours:

TBA

 

Office Hours:

TBA

Description

Writing entire programs in machine code or assembly language is a tedious prospect. To aid in the rapid development of computer programs, we often wish to express algorithms in English-like high-level languages. These languages might be converted into machine code by an auxiliary program known as a compiler. Technically, a compiler is a program that converts a source language to a target language, where the source and target languages can be programming languages, human languages, machine code, or other representations of code and data.

In this course, we will explore the design and implementation of a compiler, including building a compiler from scratch for a simple programming language. We will explore the phases of compilation, which include tokenizing the input and doing lexical analysis, parsing, semantic analysis, and code generation. We will also focus on a class of transformations known as optimizations that may improve the quality of generated code.


Course Purposes and Goals

This course has two major objectives:

  1. To discuss the algorithms and techniques necessary for the proper and useful operation of a compiler
  2. To use modern tools and good design to create a compiler for a simple programming language.

Textbook

Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, & Tools, Second Edition. Boston: Addison-Wesley, 2007.

0321486811

Class Policies

Exams:  There will be a midterm and a final. The exams will be closed book/notes. The final exam will be in the normal classroom. Cheating on exams will not be tolerated.  Anyone caught cheating will be given a zero for the test or for the course and reported to the department following University procedures.

Projects:  There will be 5 out-of-class assignments given.  These are to be completed in the given time (no extensions will be given without a valid excuse. LATE WORK IS NOT ACCEPTED. Contact me before the deadline for clarifications.)  These are meant to be your own work; anyone found to be collaborating will be disciplined in accordance to University policy.  Cheating means (but is not limited to): using code from previous terms, other universities, your friends, finding it on the Internet, getting help from unapproved forums, or outsourcing it.

Homework and Quizzes:  Unfortunately, many of the algorithms we will learn need to be practiced before an exam. There will be periodic homework and quizzes to give you practice with the material.

Participation:  Attendance will not be taken, but in a small class, any absence will be noticed.  Several unexcused missed classes will adversely affect your grade.


Grading

Your grade will be based upon 2 exams, 5 projects, homework and quizzes (the lowest one of which will be dropped), and participation:

First Midterm

20%

Final Exam

20%

5 Projects

45% (5% + 4*10%)

Homework and Quizzes

10%

Participation

5%

Total

100%

Disability Resources and Services:

If you have a disability for which you are requesting an accommodation, you are encouraged to contact both your instructor and Disability Resources and Services, 216 William Pitt Union, (412) 648-7890, as early as possible in the term. DRS will verify your disability and determine reasonable accommodations for this course.

Academic Integrity

Students are expected to comply with the University of Pittsburgh’s Policy on Academic Integrity. Any student suspected of violating this obligation for any reason during the semester will be required to participate in the procedural process as outlined in the University Guidelines on Academic Integrity. For further information see: http://www.pitt.edu/~provost/ai1.html


Term Schedule

The daily topics are subject to change depending on our pace.  They are there to assist you in the readings so you can focus on those concepts prior to class.

Week 1: 1/7/2013 - 1/9/2013

Readings: Chapter 1 & 2

 

Topics:

·         Intro to the Course

·         Begin Lexical Analysis

 

Week 2: 1/14/2013 - 1/16/2013

Readings: Chapter 3

 

Topics:

·         Lexical Analysis

·         Regular Expressions

·         DFA and NFA

·         Tools

 

Week 3: 1/21/2013 - 1/23/2013

Readings: Chapter 4

 

Topics:

·         Parsing

·         Recursive descent

·         LL(k) and LR(k) grammars

 

Week 4: 1/28/2013 - 1/30/2013

Readings: Chapter 4

 

Topics:

·         Table parsers

·         Parsing continued

·         Parser generators

·         Errors

 

Week 5: 2/4/2013 - 2/6/2013

Readings: Chapter 5

 

Topics:

·         Abstract Syntax

·         Parse Trees

·         Syntax-directed translation

 

Week 6: 2/11/2013 – 2/13/2013

Readings:  Chapter 6

 

Topics:

·         Semantic Analysis

·         Type Checking

 

Week 7: 2/18/2013 - 2/20/2013

Readings: Chapter 7

 

Topics:

·         Runtime Environment

·         Activation Records

 

Week 8: 2/25/2013 - 2/27/2013

Wednesday, February 27, 2012: Midterm Exam

 

Topics:

  • Review for midterm exam

 

Week 9: 3/4/2013 - 3/6/2013

Readings: Chapter 6

 

Topics:

·         Intermediate representations

·         Static Single Assignment

 

Spring Break: 3/11/2013 - 3/13/2013

 

Spring break: no classes this week

Week 10: 3/18/2013 - 3/20/2013

Readings:  Chapter 8

 

Topics:

·         Straight line code

·         Basic blocks

·         Traces

 

Week 11: 3/25/2013 - 3/27/2013

Readings: Chapter 7 & 8

 

Topics:

·         Garbage collection

·         Instruction selection

·         Code generation

Week 12: 4/1/2013 - 4/3/2013

Readings: Chapter 9

 

Topics:

·         Dataflow Optimizations

 

Week 13: 4/8/2013 - 4/10/2013

Readings: Chapter 9

 

Topics:

·         Control flow optimizations

 

Week 14: 4/15/2013 - 4/17/2013

Readings: Chapter 10 & 11

 

Topics:

·         Machine specific optimizations

 

Finals week: 4/22/2013 - 4/24/2013

Readings:

 

Topics:

·         Prepare for the final exam

 

WEDNESDAY, April 24, 2013: 4:30-5:45pm in the normal classroom