This page contains a set of jupyter scala notebooks for the undergraduate course Principles of Programming Languages course (CSCI 3155) at the University of Colorado Boulder.
If you are teaching a similar course at a university, and would like access to problem sets that go with these notes, email Sriram for access.
Principles of programming language is a core course in the CS curriculum at CU Boulder that focuses on the following topics:
Students use the notes from this page as their official textbook. Additionally, we have:
You can interact with the material locally on your computer by fist installing jupyter notebooks with scala kernel. Alternatively, we have links to notebooks hosted on the google colaboratory below.
We have provided links to notebooks on the google drive below.
You can open them by clicking on the google drive link. Choose “google colab” as the application for opening the
If you are facing technical challenges, please let Sriram know.
Please install jupyter using a standard python package repository such as anaconda or pip. For running jupyter notebooks with scala, you will need to install the Almond kernel for scala. It works well with Java 1.8 and 1.11 (the stable versions for the JDK). However, we have made it work for other Java versions with careful choice of the almond kernel, sbt and scala versions. Once jupyter notebooks with almond kernel for scala is installed on your local machine, just check out the notebooks from our github repository and view them.
Here are links to the notes roughly in the order we cover them. They will open on google colab: you will need a google account to view them. See the github repository for alternatives.
|Chapter||Description (Google Colab Link)|
|1||Basic Introduction to the Scala Language|
|2||Constructing Programs: A Brief Primer|
|4||Inductive Definitions and Inductively Defined Structures|
|5||Operations on Inductively Defined Structures|
|6||A Brief Introduction to Parsing|
|7||Functors in Scala: Map, Filter and Fold|
|8||Big Step Operational Semantics : Introduction|
|9||Lettuce: A toy language with let-bindings|
|10||Lettuce: Scopes and Environments|
|11||Function Calls and Closures in Lettuce|
|12||Recursion in Lettuce: Y-Combinators and Circular Scopes|
|13||References, Mutable Vars and Side Effects|
|15||Calling Conventions: Call by Value vs. Reference|
|16||Garbage Collection: Basic Concepts|
|17||Continuation Passing Style (CPS): Converting to Tail Recursion|
|19||Types and Type Checking|
|20||Type Inference: Basic Idea|
|21||Type Inference: Unification and Constraint Solving|
|22||Introduction to Object Oriented Concepts (in Scala)|
|23||Traits, Type Parameters, Generics and Type Constraints|
|24||Subtyping and Variance Annotations|
|25||Lazy Evaluation, Streams, Iterators and Comprehensions|
I have also a scala implementation of the Lettuce programming language interpreter with a visualization that shows how the interpreter works. It shows the various steps of the interpreter, the corresponding environment and illustrates how function calls work.
Click here for the git repository and instructions to run.
The notebooks form the official “textbook” for this class. Sriram Sankaranarayanan is the author of these notebooks, and takes full responsibility/blame for their contents. The original goal of these notes was to translate the wonderful book: Essentials of Programming Languages by Daniel P. Friedman and Mitchell Wand into the Scala language used in our class as lecture notes. However, the notes have since diverged significantly from Friedman and Wand’s textbook. Nevertheless, the reader interested in studying this subject further is asked to consult the textbook above since the notes themselves lack important bibliographic references and an adequate coverage of the more advanced topics.
Spencer Wilson contributed comments/critique and many of the in-class notebooks that gave Sriram the idea for using Jupyter notebooks.
This course teaches material similar to the principles of PL course designed by Prof. Bor-Yuh Evan Chang, but following a different pedagogical style. Sriram is thankful to Prof. Chang for designing this class in the first place. These lecture notes were inspired by Prof. Chang’s own notes.
The notebooks have evolved thanks to comments by current and past TAs including Albert Dayn, David Moon, Kyle Headley, Jack Martin, Monal Narasimhamurthy, and Rohit Mehra. Many students contributed typo fixes and suggestions.