CS160: Translation of Programming Languages

Introduction


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 (optional) text book for the class: Engineering a Compiler (3rd edition), by Keith D. Cooper and Linda Torczon, Morgan Kaufmann. 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).

News


  • There final will be on Monday, December 11, 2023 from 12:00pm to 2:00 pm (in PSYCH 1924, the class room). This is a closed book exam. Also, the final will be cumulative, but with a focus on the material covered in the second half of the class.
  • There midterm will be on Tuesday, November 7, 2023 in class. This is a closed book exam.
  • There will be no discussion sections on Wednesday, October 3 2023
  • No class on Tuesday, October 2 2023
  • First lecture is on Thursday, September 28 2023 at 12:30PM

General Information


Lectures:Tue/Thu, 12:30PM - 01:45PMPSYCH 1924
Discussions:Wed, 05:00PM - 05:50PMPHELP 1445
Discussions:Wed, 06:00PM - 06:50PMPHELP 1444
Instructor:Christopher Kruegelchris (at) cs.ucsb.edu
Office hours:Thu, 11:00AM - 12:00PMHarold Frank Hall 2117
TAsJoseph Ngjoseph_ng (at) umail.ucsb.edu
Thanawat Techaumnuaiwitthanawat (at) umail.ucsb.edu
Office/Lab hours:Tue, 2pm-3pmCSIL Lab
Fri, 12pm-1pmCSIL 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.

Projects50%
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.