Important #1: Click to register with Gradiance with class token ADF0B423.
Important #2: Access Gradescope for this course from Canvas.

What do we teach?

  • How do we make high-level programming languages efficient by optimizing the code? (Data-flow analysis)
  • 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)
  • Can we use program analysis to improve the quality of the code? (Satisfiability Modulo Theories)
  • How do we automatically manage memory efficiently so users do not have to manage it themselves? (Garbage collection)
  • The highest programming language is obviously natural language. With the recent introduction of large language models such as GPT3 and CodeX, how do we let consumers code in natural language using machine learning? Note: no prior knowledge in machine learning is needed. (Neural networks)

How do you learn this?

As compilers are one of the most complex programs we write, by teaching compilers, we are also teaching software engineering. It is a course where programming and mathematics meet. We show how to apply general mathematical concepts (fixpoint computations, graph theory, linear algebra, binary decision diagrams, neural networks) to handle various complex programming problems. You will learn how to formulate solutions to problems, and not just memorizing prior work.

How is the course structured?

  • Interactive lectures, textbook reading.
  • Programming assignments analyze Java code.
  • Written assignments explore mathematical concepts from lectures.
  • Problem sessions for discussion.
  • Ed for offline questions.
  • 2 Exams.

Logistics When, where, what and how

Lectures Monday and Wednesday 4:30 pm - 5:50 pm, Thornton 102
Review Session Friday 9:30 am - 10:20 am, Huang 018
Prerequisites CS 103 or CS 103B, and CS 107; Java programming language experience
Textbook Compilers: Principles, Techniques, and Tools (Second Edition), Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Addison-Wesley, 2007.
Class Q&A Website CS243 on Ed, for all questions related to course material
Videos of Lectures CS243 Canvas Page
Staff Mailing List
Office Hours Sign-up QueueStatus 2534
SCPD Office Hours Sign-up on QueueStatus, write SCPD in name
Midterm Wednesday, Feb 14, 2024: 4:30pm - 5:50pm (in class)
Final Exam Monday, Mar 18, 2024: 7pm - 10pm, Building 370, Room 370

Where do I ask questions?

All questions related to the material should go to Ed. Using Ed for questions reduces 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 go to . Please do not email individual staff members.

Grading Policy

Assignments 55%
Midterm Examination 15%
Final Examination 30%
Extra Credit: Lab: up to 3%

Staff Professor and TA details

Monica Lam, Instructor

Office Gates 344
Office Hours Wednesdays:
after class
Contact Details

Angelica Teaupa, Admin

Office Gates 372
Phone (650) 724-5040

How are office hours structured?

The TAs each hold office hours twice a week, simultaneously in person and over Zoom, using QueueStatus. The instructor holds office hours after class on Wednesday.

Lovish Chopra, TA

Office Building 120-314 and Zoom
Office Hours Tuesday and Thursday: 11 am - 12 noon
Contact Details

James Dong, TA

Office Gates 464
Office Hours Friday 10:30 am – 12 noon
Monday 11:30 am – 12:30 pm; only
Contact Details

Zhemin Huang, TA

Office Huang Basement and Zoom
Office Hours Thursday 4:30 pm - 5:30 pm
Contact Details

Tentative Schedule Subject to change

Date Topic Reading Lecture notes Assignment out Assignment due Review Session (Fri)
Jan 8 [Mon]Introduction1.1-5, 8.4, 8.5, 9.1Lecture 1
Jan 10 [Wed]Dataflow Analysis Introduction9.2Lecture 2
Jan 15 [Mon]holiday
Jan 17 [Wed]Dataflow Analysis Foundation9.3Lecture 3HW1, Gradiance, SolutionsData flow analysis
Jan 22 [Mon]Constant Propagation, Loops9.4, 9.6Lecture 4
Jan 24 [Wed]Partial Redundancy Elimination9.5Lecture 5HW2, Starter CodeHW1JoeQ
Jan 29 [Mon]Register Allocation8.8Lecture 6
Jan 31 [Wed]Instruction Scheduling10.1–10.4Lecture 7HW3, Gradiance, SolutionsHW2HW3 Concepts + PRE
Feb 5 [Mon]Software Pipelining10.5Lecture 8
Feb 7 [Wed]Parallelization11.1–11.4, 11.6Lecture 9HW4, Starter CodeHW3HW 4 + Dataflow Example
Feb 12 [Mon]Loop Transformations11.7-11.9Lecture 10
Feb 14 [Wed]Midterm (in class)Midterm 2007 (Solutions), Midterm 2016 (Solutions), Midterm 2023 (Solutions)SW Pipelining, Affine Transforms
Feb 19 [Mon]holiday
Feb 21 [Wed]Pipelined Parallelism11.8, 11.9Lecture 11HW5, Gradiance, SolutionsHW4HW5-related concepts
Feb 26 [Mon]Locality + ParallelismLecture 12
Feb 28 [Wed]SSA and SMT (Satisfiability Modulo Theories) IntroLecture 13HW6, Gradiance, Starter Code, SolutionsHW5HW6-related concepts and SSA
Mar 4 [Mon]SMT SolversLecture 14
Mar 6 [Wed]Garbage CollectionLecture 15HW7, SolutionsHW6HW7 + GC
Mar 11 [Mon]Pointer AnalysisLecture 16
Mar 13 [Wed]Conversational Interface to Hybrid Data SourcesLecture 17HW7
Mar 18 [Mon]Final (7:00pm - 10:00 pm),
Location: Building 370, Room 370
Final 2019 (Solution); Final 2023 (Solution);Final Review

Handouts and Graded Assignments

Lecture notes will be available for download by the morning of the lecture. Assignment handouts will be available on this page on the day it is assigned. Unless otherwise stated, written assignments should be submitted through Gradescope.

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

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.

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!

The written homework should be submitted via Gradescope. You may access Gradescope through the corresponding tab in Canvas.

We will also assign some homework 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 Office of Community Standards. If convicted, the normal penalty is a quarter suspension or worse.

The full honor code can be found here