Computer Science
>
>

CS 164: Programming Languages and Compilers

Fall 2022

UC Berkeley

Explores how compilers translate high-level languages into machine-understandable code, offering practical experience with developing compilers for various languages. Also covers reasoning about compiler correctness and understanding runtime errors.

Course Page

Overview

Have you ever wondered why C programs seem to run faster than Python programs? Have you ever been confused by an error message and wondered why Java couldn’t understand your program? In CS 164, we’ll learn how compilers take in code in one language and produce code in another; in particular, we’ll learn how to translate high-level languages into code that your computer’s processor can understand. We’ll get hands-on practice developing compilers for a series of increasingly complex languages. Along the way, we’ll learn some general best practices for developing and testing complex software systems.

Prerequisites

Course Culture

Students taking CS 164 come from a wide range of backgrounds. We hope to foster an inclusive and safe learning environment based on curiosity rather than competition. All members of the course community—the instructor, students, and GSIs—are expected to treat each other with courtesy and respect. Some of the responsibility for that lies with the staff, but a lot of it ultimately rests with you, the students.

Learning objectives

After completing this course, students will be able to:

  • Develop programs to translate between different programming languages
  • More broadly, develop programs that operate on programs
  • Explain the relationship between compilers and interpreters, and the differences between them
  • Understand the tools they use to run programs—and the errors those tools produce
  • Assign meaning to high-level language constructs
  • Implement high-level language constructs
  • Reason about what it means for a compiler to be correct
  • Reason about undefined behavior
  • Read and write assembly language
  • Write a parser

Textbooks and other notes

There is no textbook for the course; all readings will be provided digitally.

Other courses in Compilers

CS 243: Program Analysis and Optimizations

Winter 2023

Stanford University

15-411 Compiler Design

Fall 2020

Carnegie Mellon University

CS 143 Compilers

Spring 2022

Stanford University

Courseware availability

Lecture slides available at Schedule

No videos available

Homework available at Schedule

Activities, Class Compiler Implementation Guides available at Schedule

Additional Resources available at Additional Resources

Covered concepts