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

What do we teach?

  • Machine learning and scientific computing need a lot of cycles; machines such as GPUs are complex to code. How do we automatically generate efficient code for these machines effectively. (Parallelism and Locality)
  • The highest programming language is obviously natural language. Can we program our virtual assistant to perform compound tasks in natural language? We use machine learning techniques to map natural language into formal languages. Note: no prior knowledge in machine learning is needed. (Neural networks, Satisfiability Modulo Theories)
  • Can we use program analysis to automatically detect security bugs in programs? (Pointer analysis)
  • How do we automatically manage memory efficiently so users do not have to manage it themselves? (Garbage collection)
  • How do we make high-level programming languages efficient by optimizing the code? (Data-flow analysis)

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.
  • Gradiance assignments explore mathematical concepts from lectures.
  • Programming assignments analyze Java code.
  • Problem sessions for discussion.
  • Piazza for offline questions.
  • 2 Exams.

Logistics When, where, what and how

Lectures Tuesday and Thursday 3:15-4:45pm in Gates B1
Review Session Friday 12:15pm - 1:15pm on Zoom
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 CS 243 Canvas Page
Staff Mailing List
Office Hours Sign-up QueueStatus 1874 (for zoom, no need to signup if come in person)
SCPD Office Hours Zoom, sign-up on QueueStatus if need private room
Midterm April 28 during class (3:15p-4:15p)
Final Exam June 8 3:30p-6:30p, Building 300, Rm 300

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 It's not recommended to email individual staff members.

Grading Policy

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

Staff Professor and TA details

John Whaley, Instructor

Office Hours Tuesdays and Thursdays:
after class
Contact Details

Dror Maydan, Instructor

Office Hours Tuesdays and Thursdays:
after class
Contact Details

Jeff Ullman, Instructor

Office Hours Tuesdays and Thursdays:
after class
Contact Details

Andrea Brand-Sanchez, Admin

Phone (650) 723-1658

Ross Daly, TA

Office Hours Wednesdays 3:30PM - 5:00PM @ Gates 259, or zoom
Contact Details

Yancheng Ou, TA

Office Hours Mondays 3:30PM - 5:00PM @ Gates 259, or zoom
Contact Details

How are office hours structured?

The TAs each hold office hours once a week (or by appointment). The instructors hold office hours by arrangement via email.

Tentative Schedule Subject to change

Date Topic Instructor Reading Lecture notes Assignment out Assignment due
Mar 29 [Tue]IntroductionWhaley1.1-5, 8.4, 8.5, 9.1Lecture 1 PDF
Mar 31 [Thu]Dataflow Analysis IntroductionUllman9.2Lecture 2 PDF(rev.1) PPTX(rev.1)Gradiance1Apr 12
Apr 5 [Tue]Dataflow Analysis FoundationUllman9.3Lecture 3 PDF(rev.1) PPTX(rev.1)HW1, solApr 12
Apr 7 [Thu]Constant Propagation, LoopsUllman9.4, 9.6Lecture 4 PDF(rev.1) PPTX(rev.1)
Apr 12 [Tue]Partial Redundancy EliminationUllman9.5Lecture 5 PDF PPTXHW2 & Gradiance2Apr 19 (both)
Apr 14 [Thu]Register AllocationMaydan8.8Lecture 6 PDF(rev.1) PPTX(rev.1)
Apr 19 [Tue]Pointer AnalysisWhaley12Lecture 7 PDFHW3 & Gradiance3May 5 (HW3), Apr 26 (Gradiance)
Apr 21 [Thu]BDDs in Pointer AnalysisWhaley12Lecture 8 PDF2021 Midterm (solutions)
2016 Midterm (solutions)
Apr 26 [Tue]Instruction SchedulingMaydan10.1-10.4Lecture 9 PDF(rev.1)
Apr 28 [Thu]First ExaminationMidterm reference solution PDFHW4 description, HW4 handoutMay 10
May 3 [Tue]Software PipeliningMaydan10.5Lecture 10 PDF(rev.1)Gradiance4May 10
May 5 [Thu]Dependence AnalysisMaydan10.5Lecture 11 PDF
May 10 [Tue]Loop OptimizationMaydan11.7-11.9Lecture 12 PDF(rev.1)HW5 sol May 17
May 12 [Thu]Neural Network CompilersMaydanLecture 13 PDFGradiance5May 24
May 17 [Tue]Static Analysis and Blockchain SecurityTarditiLecture 14 PDF
May 19 [Thu]Satisfiability Modulo Theories (SMT)BarrettLecture 15 PDFHW6 May 26
May 24 [Tue]Garbage CollectionWhaley7.4 - 7.7.4Lecture 16 PDFGradiance6May 31
May 26 [Thu]Dynamic CompilationWhaleyPaperLecture 17 PDF
May 31 [Tue]Guest Lecture: OpenRefactoryHafizLecture 18 PDF

Review Sessions

Handouts and Graded Assignments

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" A1F858D4.

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 submit written assignments to us through the CS 243 Gradescope. Lecture notes will be available for download by the morning of the lecture.

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