Important #1: Click to sign up for this class on Piazza!
Important #2: Click to register with Gradiance with class token 548ED169.

What do we teach?

This course teaches program analysis techniques used in compilers and software development tools to improve productivity, reliability, and security. Emphasis on the methodology of applying mathematical abstractions such as graphs, fixpoint computations and binary decision diagrams to writing complex software, using compilers as an example.

How do you learn this?

This is a course where math and programming meet. Learning compiler techniques has much in common with learning mathematical proofs. You learn by trying, finding your own insights. This means the assignments can take a variable amount of time! We want you to formulate your own variations of problems and solve them.

How is the course structured?

  • Highly interactive lectures, textbook reading.
  • Programming assignments analyze Java code.
  • Problem sessions for discussion.
  • Piazza for offline questions.
  • Midterm and Final.

Logistics When, where, what and how

Lectures Mondays and Wednesdays 11:00am - 12:15pm in Gates B03
Problem Session TBD
Prerequisites CS 103 or CS 103B, and CS 107; Java programming language experience
Textbook Compilers: Principles, Techniques, & Tools (Second Edition), Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Addison-Wesley, 2007.
Class Q&A Website CS243 on Piazza - for all questions related to the material
Videos of Lectures SCPD Webcast for Stanford Students
Staff Mailing List for administrative questions
Midterm February 11 at Gates B03
Final March 20 (Friday) 8:30am-11:30am

Where do I ask questions?

All questions related to the material should go to Piazza. Using Piazza for questions should significantly decrease the average response time, since there are more instructor/TAs and students there to see the question. If another student can answer the question, that will help them learn, too.

Administrative questions should all go to Please do not email individual staff members.

Grading Policy

Gradiance 10%
Additional Assignments 45%
Midterm 15%
Final 30%
Lab Extra Credit up to 10% (applied after curve)

Staff Professor and TA details

IMPORTANT Contact us using the for administrative questions.

Monica Lam, Instructor

Office Gates 307
Office Hours By arrangement via
Contact Details

Darlene Hadding, Admin

Office Gates 408
Phone (650) 723-1430

How are office hours structured?

The TAs each hold office hours twice a week. The instructor holds office hours by arrangement via email.

SCPD students Join the Google Hangout during office hours (link posted on Piazza).

Guoxing Li, TA

Office B26A
Office Hours Thu 4:00-6:00 pm
Fri 1:00-3:00 pm
Contact Details

Amritha Raghunath, TA

Office B28
Office Hours Mon 9-11 am
Tue 2:15-4:15 pm
Contact Details

Tentative Schedule Subject to change

Date Topic Reading Lecture notes Assignment out Assignment due
Jan 5 [M]Introduction1.1-5, 8.4, 8.5, 9.1Lecture 1 Handout, Slides, Example
Jan 7 [W]Dataflow Analysis Introduction9.2Lecture 2 Handout, Slides
Jan 12 [M]Dataflow Analysis Foundations9.3Lecture 3 Handout, Slides
Jan 14 [W]Constant Propagation, Loops9.4, 9.6Lecture 4 Handout, SlidesHW1 (Solution)Jan 21
Jan 19 [M]MLK day, no class
Jan 21 [W]JoeQ FrameworkJoeQ slides HW2Jan 30
Jan 26 [M]Partial Redundancy Elimination9.5Lecture 5 Handout, Slides
Jan 28 [W]Register Allocation8.8Lecture 6 Handout, SlidesHW3 (Solution)Feb 4
Feb 2 [M]Instruction Scheduling10.1-10.4Lecture 7 Handout, Slides
Feb 4 [W]Software Pipelining10.5Lecture 8 Handout, Slides,
Sample Midterm (Solutions)
HW4Feb 20
Feb 9 [M]Dynamic CompilationLecture 9 Handout, Slides
Feb 11 [W]MidtermMidterm solutions
Feb 16 [M]President's Day, no class
Feb 18 [W]Pointer Analysis12Lecture 10 HandoutHW5 (Solutions)Feb 25
Feb 23 [M]BDDs in Pointer Analysis12Lecture 11 Handout
Feb 25 [W]Datalog-based query language for graph analysisSocialite HandoutHW6March 6
Mar 2 [M]Data Dependence Analysis11.1-11.1.4, 11.6Lecture 12 Handout, Slides
Mar 4 [W]Loop Transformations11.10-11.11Lecture 13 Handout, SlidesHW7 (Solutions), Omega TutorialMarch 11
Mar 9 [M]Garbage Collection7.4, 7.5, 7.6Lecture 14 Handout, Slides
Mar 11 [W]Advanced Garbage Collection7.7, 7.8Lecture 15 Handout, Slides
Mar 20 [F]Final (8:30 am - 11:30 am)

Problem Sessions Friday 9:00am - 9:50am at Gates B01

Date Problem Session
Jan 23 Section on Homework 2
Jan 30 Flow graph theory
Feb 6 Selected problems from previous midterms
Feb 13 Section on Homework 4
Feb 27 Section on Homework 6
Mar 06 Omega Tutorial

Handouts and Graded Assignments What happens with physical materials

CS243 will be using the Gradiance automated homework system for some of the required work. You should open your free account at and then sign up for the class using the "class token" 548ED169.

Gradiance looks like multiple-choice questions, but it is really quite different. You are given problems to work out, just as you would in an ordinary homework. You are then given a multiple-choice question to test whether or not you have the correct solution. If you get a choice wrong, you are given a hint and encouraged to try again. You are allowed to try as many times as you like, and the goal is to get everything right eventually. To avoid repeated guessing on one problem at a time, you need to repeat all the questions each time you submit, and you will be given a different set of choices each time.

SCPD students: Please download the lecture notes before the lecture; the material will be available by the morning of the lecture. Your assignments will be returned via the SCPD courier. Since all the material for the assignments will be available on the web, you have to give your assignments to the SPCD courier (or hand it in electronically) on the same day as everybody else.

Assignment Policy

Group Work

Homework will consist of both written and programming assignments. You are encouraged to work on the programming assignments in groups of two, but you must do the written assignments by yourself.

Late Policy

In general, no late assignments are accepted. However, you have two grace days for the entire quarter. That means you can be late by one day for two assignments, or use the two days up for one assignment.


Programming assignments will have specific submission instructions included with the handouts. We will use a certain amount of automatic grading to help us deal with the massive amounts of code everyone submits, so please follow the submission instructions exactly as written!

Some of the written homework should be submitted via Gradiance, as described above. If you have any issues accessing the Gradiance site, please contact the TAs.

Where are the assignments?

All assignments are posted on the schedule

Honor Code Cheating and Plagiarism is a no-no

You are free to discuss the assignment and solutions with others. However, you must write your own assignment, and must not represent any portion of others' work as your own. Anybody violating the honor code will be referred to the Judical-Affairs Office. If convicted, the normal penalty is a quarter suspension or worse.

The full honor code can be found here

© Stanford 2014 | Built using the Bootstrap framework by your friendly TA