Important #1: Click to register with Gradiance with class token 9636EBF6.
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 3:00 pm - 4:20 pm, Gates B3
Review Session Friday 2:30 pm - 3:20 pm, Hewlett 201
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
SCPD Office Hours Sign-up on QueueStatus, write SCPD in name
Midterm Wednesday, Feb 12, 2024: 3:00pm - 4:20pm (in class)
Final Exam Tuesday, Mar 18, 2025: 8.30am - 11.30am, Location 370-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
Email

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.

Robert Chen, TA

Office CoDa Fortinet Student Commons (CoDa Basement) and Zoom
Office Hours Tuesday 5-6pm (Zoom) / Thursday 3-4pm (CoDa)
Contact Details

Varun Desai, TA

Office Huang Basement and Zoom
Office Hours Monday 2-3pm (Huang) / Thursday 5-6pm (Zoom)
Contact Details

Tentative Schedule Subject to change

Date Topic Reading Lecture notes Assignment out Assignment due Review Session (Fri)
Jan 6 [Mon]Introduction1.1-5, 8.4, 8.5, 9.1Lecture 1
Jan 8 [Wed]Dataflow Analysis Introduction9.2Lecture 2
Jan 13 [Mon]Dataflow Analysis Foundation9.3Lecture 3
Jan 15 [Wed]Constant Propagation, Loops9.4, 9.6Lecture 4HW1, GradianceData flow analysis
Jan 20 [Mon]holiday
Jan 22 [Wed]Partial Redundancy Elimination9.5Lecture 5HW2, Starter Code, JoeQ DocumentationJoeQ
Jan 27 [Mon]Register Allocation8.8Lecture 6
Jan 29 [Wed]Instruction Scheduling10.1–10.4Lecture 7HW3, GradianceHW3 Concepts + PRE
Feb 3 [Mon]Software Pipelining10.5Lecture 8
Feb 5 [Wed]Parallelization11.1–11.4, 11.6Lecture 9HW4, Starter CodeHW4 + Midterm Topics
Feb 10 [Mon]Loop Transformations11.7-11.9Lecture 10
Feb 12 [Wed]Midterm (in class)Midterm 2007 (Solutions), Midterm 2016 (Solutions), Midterm 2023 (Solutions)SW Pipelining, Data Dependence Analysis
Feb 17 [Mon]holiday
Feb 19 [Wed]Pipelined Parallelism11.8, 11.9Lecture 11HW5, GradianceHW5 concepts, Affine Transforms
Feb 24 [Mon]Locality + Parallelism11.9 - 11.11Lecture 12
Feb 26 [Wed]SSA and SMT (Satisfiability Modulo Theories) IntroLecture 13HW6, Gradiance, Starter CodePipelined Parallelism, SSA, SMT
Mar 3 [Mon]SMT SolversLecture 14
Mar 5 [Wed]Garbage Collection7.4-7.7.4Lecture 15HW7 & Gradiance
Mar 10 [Mon]Pointer Analysis12Lecture 16
Mar 12 [Wed]Conversational Interface to Hybrid Data Sources
Mar 18 [Tue]Final (8:30am - 11:30am),
Location: TBD
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 www.gradiance.com/services and then sign up for the class using the "class token" 9636EBF6.

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.

Submission

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