/CS160

Primary LanguageOCaml

CS160 Compilers

The goal of this course is to give an introduction to compiler, a computer program that translate source code from a high-level programming language to a lower level language to create an executable program. Through this course, you will learn to build a compiler from scratch.

The workloads include 5 programming assignments.

Office hour

Instructor: Yu Feng (yufeng@UCSBCS)

TA: Junrui Liu (junrui@ucsb), Jingtao Xia (jingtaoxia@ucsb.edu), Thanawat Techaumnuaiwit (thanawat@uscb.edu)

Class: Mon & Wed, 2-3pm, HSSB 1174

Sections:

  • Thur 3-4pm (ILP 4209)
  • 4-5pm (ILP 4209)
  • 5-6pm (ILP 2207)

Instructor's office hour: Wed, 3-4pm, HFH 2157

TA's office hour:

  • Jingtao Xia: Tue 11am-12pm (Phelps 3523)
  • Junrui Liu: Thur 11am-12pm (Phelps 3523)
  • Thanawat Techaumnuaiwit: Fri 1-2pm (CSIL)

Slack: https://join.slack.com/t/cs160-spring23/shared_invite/zt-1sdvkrlh1-goq7CANHgzKNCgAWr3a4Sg

Date Topic Slides Read Out Due
4/3 Welcome & Course Overview lec1
4/5 OCaml Crash Course, Part I lec2
4/10 OCaml Crash Course, Part II lec3 hw1
4/12 OCaml Crash Course, Part III lec4
4/17 Lexical Analysis lec5
4/19 Regular Expressions and FSM lec6
4/24 Revisiting DFA and NFA lec7 hw1
4/26 Introduction to parsing lec8 hw2
5/1 More about parsing lec9
5/3 Parsing Algorithms lec10
5/8 - hw2 (tentative)
5/10 Type System and Soundness lec11
5/15 Type Checking I lec12 hw3
5/17 Type Checking II lec13
5/22 Code Generation I lec14 hw4 (tentative) hw3
5/24 TBD
5/29 Code Generation II lec14 hw5 (tentative) hw4
5/31 Optimization I lec15
6/5 Optimization II
6/7 Optimization III
TBD Final week, no class
6/12 - hw5 (tentative)

Grading

  1. Programming assignments: 80%

    1. 5 programming assignments, 16% each
  2. Take-home midterm: 20%

Below is a grading system used by CS160 (No curving).

Letter Percentage
A+ 95–100%
A 90–94%
A- 85–89%
B+ 80–84%
B 75–79%
B- 70–74%
C+ 65–69%
C 60–64%
F <60%

Credit: https://en.wikipedia.org/wiki/Academic_grading_in_the_United_States

Useful resources

You will find the Patina materials very helpful during this course.

Textbook (Optional): Cooper, Keith, and Linda Torczon. Engineering a compiler.

These resources are helpful for learning OCaml:

  1. OCaml From the Ground Up: this is a good step-by-step introduction to OCaml.
  2. Real World OCaml: a comprehensive guide on OCaml: how to use it, the ecosystem and tooling, and common libraries.
  3. The OCaml system: the official user manual for OCaml. Part I is helpful for seeing examples of what OCaml has to offer. You may also want to look at Part III, Chapter 17 for information on how to use the debugger.
  4. OCaml official documentation
  5. Learning OCaml in Y mins

Academic Integrity

  • Cheating WILL be taken seriously. It is not fair toward honest students to take cheating lightly, nor is it fair to the cheater to let him/her go on thinking that cheating is a reasonable alternative in life.
  • The following is not considered cheating:
    • discussing broad ideas about programming assignments in groups, without being at a computer (with code-writing and debugging done individually, later).
  • The following is considered cheating:
    • discussing programming assignments with someone who has already completed the problem, or looking at their completed solution.
    • looking at anyone else’s solution
    • Previous versions of the class.
    • leaving your code (for example in an online repository) visible to others, leading others to look at your solution.
    • receiving, providing, or soliciting assistance from unauthorized sources during a test.
  • Programming assignments are not intended to be grade-makers, but to prepare you for the tests, which are the grade-makers. Cheating on the programming assignment is not only unethical, but shows a fundamental misunderstanding of the purpose of these assignments.
  • Penalties: First time: a zero for the assignment; Second time: an “F” in the course.