CS 1622–Intro to Compiler Design

Fall Term: 2181

 

Class

Time:

1:00 – 2:15 PM

Days:

MW

Room:

5313 Sennott Square

Webpage:

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

Contact Information

 

Instructor: Jonathan Misurda

 

TA: Mohammad Hasanzadeh Mofrad

Office:

6203 Sennott Square

 

Office:

6150 Sennott Square

 

Email:

jmisurda@cs.pitt.edu

 

Email:

moh18@pitt.edu

 

Office Hours:

Mon, Wed: 2:15–2:45pm
Tue, Thu: 1:00–2:15pm
Mon–Thu: mornings by appointment

 

Office Hours:

Mon: 04:30pm6:00pm
Fri: 11:00am
12:30pm

 

 

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 Monday, December 11, 2017, from 4:00 – 5:50PM, in the normal classroom. 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/28/2017 – 8/30/2017

Readings: Chapters 1 & 2

 

Topics:

·         Intro to the Course

·         Begin Lexical Analysis

 

Week 2: 9/4/2017 – 9/6/2017

Monday, September 4, 2017: Labor Day – No class

 

Friday, September 8, 2017: Fall term add/drop period ends

 

Readings: Chapter 2

 

Topics:

·         Lexical Analysis

·         Regular Expressions

·         DFA and NFA

·         Tools

 

Week 3: 9/11/2017 – 9/13/2017

Readings: Chapter 3

 

Topics:

·         Parsing

·         Recursive descent

·         LL(k)

 

Week 4: 9/18/2017 – 9/20/2017

Readings: Chapter 3

 

Topics:

·         Table parsers

·         and LR(k) grammars

 

Week 5: 9/25/2017 – 9/27/2017

 

Readings: Chapter 4

 

Topics:

·         Parser generators

·         Errors

Week 6: 10/2/2017 – 10/4/2017

Readings:  Chapter 5

 

Topics:

·         Abstract Syntax

·         Parse Trees

·         Visitor patterns

 

Week 7: 10/9/2017 – 10/11/2017

Monday, October 9, 2017: Fall Break – No class

 

Tuesday, October 10, 2017: Follow your Monday class schedule

 

Readings: Chapter 6

 

Topics:

·         Semantic Analysis

·         Type Checking

 

Week 8: 10/16/2017 – 10/18/2017

Wednesday, October 18, 2017: Midterm Exam

 

Topics:

·         Activation Records

  • Review for midterm exam

 

Week 9: 10/23/2017 – 10/25/2017

Friday, October 27, 2017: Withdrawal Deadline (For “W” grade)

 

Readings: Chapter 7

 

Topics:

·         Intermediate representations

·         Code generation

 

 

Week 10: 10/30/2017 – 11/1/2017

Readings:  Chapter 9, 11, & 12

 

Topics:

·         Register Allocation

·         Straight line code

·         Basic blocks

·         Traces

 

 

Week 11: 11/6/2017 – 11/8/2017

Readings: Chapter 13

 

Topics:

·         Runtime environments

·         Garbage collection

 

Week 12: 11/13/2017 – 11/15/2017

 

Readings: Chapter 14

 

Topics:

·         Object-oriented languages

·         Dispatch

 

Week 13: 11/20/2017 – 11/22/2017

Wednesday, November 22, 2017: Thanksgiving Break, University Closed

 

Readings: Chapter 9

 

Topics:

·         Selected optimizations

o   Dataflow

 

Week 14:  11/27/2017 – 11/29/2017

Readings: Chapters 10, 17, & 18

 

Topics:

·         Selected optimizations

o   Control flow

 

Week 15:  12/4/2017 – 12/6/2017

Readings: Chapters 10, 17, & 18

 

Topics:

·         Finish optimization

·         Review for the final exam

 

Finals Week

 

Monday, December 11, 2017, from 4:00 – 5:50PM in the normal classroom