CS160: Translation of Programming Languages


A compiler is a computer program that translates text (code) written in one language (the source language) into another language (the target language). In this course, we will study the structure and the different tasks of a compiler. This includes lexical analysis (scanning), syntax analysis (parsing), semantic analysis and type checking, and code generation. The goal is to understand the complete process: from reading the source program, checking whether it conforms to the rules of the language, and producing output that a machine can understand.

We will use the following text book for the class: Engineering a Compiler (2nd edition), by Keith D. Cooper and Linda Torczon, Morgan Kaufmann. Here is a link to the errata page. Please note that the lecture notes are important and complement the material in the book (in other words, the book itself is not sufficient).

For the projects, we will use compiler-generator tools (such as lex and yacc) to develop the front-end for our compiler. Then, we will use custom data structures (abstract syntax tree, symbol tables) to analyze the semantics of the program. Finally, we will develop a code generator to write out the appropriate machine instructions. For more details on the project schedule, please see the projects' pages (made available over the course of the class).


  • The final will be Monday, December 5 2016 from 12:00PM until 03:00PM in Phelps 3515
  • You can find the most recent two practice sheets (with solutions) that we covered in class here: Sheet 3 and Sheet 4
  • The deadline for Project 5 has been extended to Wednesday, Dec. 7, 23:59:59 PDT
  • The deadline for Project 4 has been extended to Tuesday, Nov. 22, 23:59:59 PDT
  • Project 5 released - deadline is Sunday, Dec. 4, 23:59:59 PDT
  • There will be no class on Tuesday, November 15 2016.
  • Project 4 released - deadline is Tuesday, Nov. 22, 23:59:59 PDT (extended)
  • Project 3 released - deadline is Tuesday, Nov. 8, 23:59:59 PDT
  • The deadline for Project 2 has been extended to Friday, Oct. 28, 23:59:59 PDT
  • You can find the two practice sheets (with solutions) that we covered in class here: Sheet 1 and Sheet 2
  • There will be no class on Thursday, October 20 2016.
  • Project 2 released - deadline is Friday, Oct. 28, 23:59:59 PDT (extended)
  • Midterm is scheduled on Thursday, October 27 2016 in class
  • Project 1 released - deadline is Friday, Oct. 14, 23:59:59 PDT
  • No discussion sections on Monday, September 26 2016
  • First lecture is on Thursday, September 22 2016 at 12:30PM

General Information

Lectures:Tue/Thu, 12:30PM - 01:45PMPHELP 3515
Discussions:Mon, 04:00PM - 04:50PMGIRV 2116
Discussions:Mon, 05:00PM - 05:50PMGIRV 1115
Instructor:Christopher Kruegelchris (at) cs.ucsb.edu
Office hours:Tue, 02:00PM - 03:00PMHarold Frank Hall 2117
TAsNilo Redini nredini (at) cs.ucsb.edu
Ruoyu (Fish) Wang fish (at) cs.ucsb.edu
Office/Lab hours:Tue, 03:00PM - 05:00PMCSIL Lab
Wed, 10:00AM - 12:00PMCSIL Lab
Thu, 02:30PM - 04:30PMCSIL Lab
Fri, 10:00AM - 12:00PMCSIL Lab
Discussion board:Piazza

Grading Policy

The grading for 160 will come from two exams (midterm and final) and a number of programming projects. For these programming projects, you will build a working compiler that takes a simplified version of C as input and produces executable machine code.

Exams (Midterm and Final)50%

Project Submission and Late Policy

Project assignments are due at 11:59:59PM on the night it is due. For details on how to submit your assignments, you should read the project pages.

Policy on Cheating and Plagiarism

A note on cheating. We encourage you to talk with your classmates and discuss your approaches on projects, but any actual copying of code is cheating. Cheating will result in a 0 on the assignment, and depending on severity, can result in a failing grade or possible administrative action by UCSB.