CS 1622–Intro to Compiler Design

Fall Term: 2131

 

Class

Time:

6:00 – 7:15pm

Days:

MW

Room:

5505 Sennott Square

Webpage:

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

Contact Information

Instructor: Jonathan Misurda

 

TA: Xiangmin Fan

Office:

6203 Sennott Square

 

Office:

6509 Sennott Square

Email:

jmisurda@cs.pitt.edu

 

Email:

xiangmin@cs.pitt.edu

Office Hours:

Wed: 3-5
Tue, Thur: 2-4

 

Office Hours:

Tues: 8:30am–11:30am

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.

Prerequisites

Before enrolling in this course, you need to have completed CS 0441 – Discrete Structures for Computer Science and have completed CS 0447 – Computer Organization and Assembly Language Programming.

If you have any questions about the prerequisite material for the course, please ask at the beginning of the term.

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.

Textbooks

[Required Text]

Andrew W. Appel and Jens Palsberg. Modern Compiler Implementation in Java, 2nd edition. Cambridge University Press, October 2002.

ISBN-10: 052182060X

Class Policies

Exams:  There will be a midterm and a final. The exams will be closed book/notes. The final exam will be finals week during the last class meeting (Wednesday, December 12, 2012), in the normal classroom at the normal time. Cheating on exams will not be tolerated.  Anyone caught cheating will be given a zero for the test 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, labs and quizzes (the lowest one of which will be dropped), and participation:

First Midterm

20%

Final Exam

20%

1+1+(3 parts) = 5 Projects

40% (5% + 5% + 3*10%)

Homework and Quizzes

10%

Participation

10%

Total

100%

 

The scale for the term will be:

Percentage

100

95

90

89

85

80

79

75

70

69

65

60

< 60

Letter

A+

A

A-

B+

B

B-

C+

C

C-

D+

D

D-

F

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: 8/27/2012 - 8/29/2012

 

Readings: Chapters 1 & 2

 

Topics:

·         Intro to the Course

·         Begin Lexical Analysis

 

Week 2: 9/3/2012 - 9/5/2012

 

Monday, September 3, 2012: Labor Day, no class

Friday, September 7, 2012: Fall term add/drop period ends

 

Readings: Chapter 2

 

Topics:

·         Lexical Analysis

·         Regular Expressions

·         DFA and NFA

·         Tools

 

Week 3: 9/10/2012 - 9/12/2012

Readings: Chapter 3

 

Topics:

·         Parsing

·         Recursive descent

·         LL(k) and LR(k) grammars

 

Week 4: 9/17/2012 - 9/19/2012

Readings: Chapter 3

 

Topics:

·         Table parsers

·         Parsing continued

·         Parser generators

·         Errors

 

Week 5: 9/24/2012 - 9/26/2012

Readings: Chapter 4

 

Topics:

·         Abstract Syntax

·         Parse Trees

·         Visitor patterns

 

Week 6: 10/1/2012 - 10/3/2012

Readings:  Chapter 5

 

Topics:

·         Semantic Analysis

·         Type Checking

 

Week 7: 10/8/2012 - 10/10/2012

Monday, October 10, 2012: No class, follow your Monday schedule on Tuesday, October 11!

 

Readings: Chapter 6

 

Topics:

·         Activation Records

 

Week 8: 10/15/2012 - 10/17/2012

Wednesday, October 17, 2012: Midterm Exam

 

Topics:

  • Review for midterm exam

 

Week 9: 10/22/2012 - 10/24/2012

Friday, October 26, 2012: Withdrawal Deadline (For “W” grade)

 

Readings: Chapter 7

 

Topics:

·         Intermediate representations

 

Week 10: 10/29/2012 - 10/31/2012

Readings:  Chapter 9

 

Topics:

·         Straight line code

·         Basic blocks

·         Traces

 

Week 11: 11/5/2012 - 11/7/2012

Readings: Chapter 13

 

Topics:

·         Runtime environments

·         Garbage collection

 

Week 12: 11/12/2012 - 11/14/2012

Readings: Chapter 14

 

Topics:

·         Object-oriented languages

·         Dispatch

 

Week 13: 11/19/2012 - 11/21/2012

Wednesday, November 21, 2012: Thanksgiving Break, University Closed

 

Readings: Chapter 9

 

Topics:

·         Instruction selection

·         Code generation

 

Week 14:  11/26/2012 - 11/28/2012

Readings: Chapters 10, 17, & 18

 

Topics:

·         Selected optimizations

·         Dataflow

·         Control flow

Week 15: 12/3/2012 - 12/5/2012

Readings: Chapters 11 & 12

 

Topics:

·         Register Allocation

 

Finals Week: 12/10/2012 - 12/12/2012

 

Readings: Prepare for the final exam

 

Topics:

·         Review for the final exam

 

Final Exam:

WEDNESDAY, DECEMBER 12, 2012: 6:00-7:15pm in the normal classroom