CSCI 334: Principles of Programming Languages

Course Info

Instructor Dan Barowy
E-Mail dbarowy@cs.williams.edu
Phone x2807
Office Thompson Chemistry Lab, room 307
Lectures Section 1: Tues & Thurs, 9:55am—11:10am
Section 2: Tues & Thurs, 11:20am—12:35pm
in Thompson Chemistry Lab, room 206
Office Hours Drop-ins
Tuesdays, 1:30pm—2:30pm and
Wednesdays, 10:00am—noon
or by appointment
in TCL 307
Homework Help Thursdays, 7:00pm—9:00pm
in TCL 206
TA Hours Mon 7—9pm
Tue 7—11pm
Wed 7—11pm
Thu 7—9pm
Fri 6—8pm
Teaching Assistants Christopher Anton
Cole Erickson
Eli Meckler
Abby Miller
Ryan Patton
Dzung Pham

Course Description

Although it may not seem like it at times, all programming languages are designed for humans, not for computers. As such, choosing the wrong language for the job can have a big effect on productivity. A language choice may also have important consequences for the quality and correctness of the resulting programs. A major goal of this course is to "get under the hood" of programming language design, enabling you to make informed choices about the appropriateness of a given language for a project.

By the end of this course you will appreciate why some programming language features encourage programs with desirable qualities while others lead to ambiguous or buggy code. You will also have a deeper understanding of how programming languages are compiled, what actually happens when a program is executed on a computer, and how the programming language design affects these issues. For example, by the end of the course, you should understand why developers flocked to Java from C/C++, and why even newer languages are now taking its place.

Book Errata

The course textbook is a gentle introduction to programming languages with lots of interesting facts and good problems. I like it a lot. Unfortunately, it also contains many errors. I strongly advise you to get in the habit of looking at John Mitchell's errata page, particularly if you are having a hard time understanding a particular section.

Lectures

Week Date Topic
0 1/31 Intro, Halting Problem
Lecture 1 slides, recording (campus only)
1 2/6—2/8 Lisp and Functional Programming
Lecture 2 slides, recording (campus only)
Lecture 3 slides, recording (campus only)
2 2/13—2/15 PL Foundations
Lecture 4 slides (updated: 2018-02-19), recording (campus only)
Lecture 5 slides, recording (campus only)
3 2/20—2/22 PL Foundations; ML
Lecture 6 slides, recording (campus only)
Lecture 7 slides, recording (campus only)
4 2/27—3/1 ML and types
Lecture 8 slides, recording (campus only)
Lecture 9 slides, recording (campus only; I only started recording halfway through class)
5 3/6—3/8 Stacks and Scope
Lecture 10 slides, (sorry, no recording; phone call interrupted recorder early into class!)
Lecture 11 slides, recording (campus only)
6 3/13—3/15 First-class functions; Midterm Exam
Lecture 12 slides, recording (campus only)
Midterm review session recording (campus only)
7 4/3—4/5 Exceptions; Continuations
Lecture 13 slides, recording (campus only)
Lecture 14 slides, recording (campus only)
8 4/10—4/12 Object-Oriented Programming
Lecture 15 slides, recording (campus only)
Lecture 16 slides, recording (campus only)
9 4/19 C
Lecture 17 slides, recording (campus only)
helloworld.c user-defined-function.c struct.c automatic-memory.c manual-memory.c
10 4/24—4/26 C++
Lecture 18 slides, recording (campus only)
Lecture 19 slides, recording (campus only)
11 5/1—5/3 More Scala & Logic Programming
Lecture 20 slides, recording (campus only)
Lecture 21 slides, recording (campus only)
12 5/8—5/10 Domain-Specific Languages & Final Exam Review
Lecture 22 slides
Lecture 23 slides

Handouts

Date Number Title
1/31 1 Syllabus (updated with TA hours)
1/31 2 Honor Code
1/31 3 Homework 0
1/31 4 Homework 0 LaTeX template
2/3 5 Sample LaTeX document
2/6 6 Homework 1
2/6 7 Lecture 2 activity (insert & tree encoding)
2/8 8 Lecture 3 activity (mapcar)
2/13 9 Homework 2
2/13 10 Homework 0 solutions (in class only)
2/13 11 Lecture 4 activity 1 (more higher order functions)
2/13 12 Lecture 4 activity 2 (lambda calculus reductions)
2/20 13 Homework 3
2/20 14 Homework 1 solutions (in class only)
2/22 15 Lecture 7 activity (pattern matching; fold)
2/27 16 Homework 4
3/6 17 Homework 2 solutions (in class only)
3/6 18 Homework 3 solutions (in class only)
3/6 19 Homework 5
3/13 20 Homework 4 solutions (in class only)
4/3 21 Homework 5 solutions (in class only)
4/3 22 Midterm exam solutions (in class only)
4/3 23 Homework 6
4/3 n/a ExprVisitor.java starter code
4/10 24 Homework 7
4/19 25 Homework 6 solutions (in class only)
4/19 26 Homework 7 solutions (in class only)
4/19 28 Homework 8
5/1 29 Homework 9
5/8 30 Homework 8 solutions (in class only)

Additional Reading Material

Some of these articles may be assigned as part of homework. They may also be useful to you as a supplement to lectures and other reading. None of the readings listed on this page are required unless they are explicitly assigned in homework or in lecture.

  1. Why Undergraduates Should Learn the Principles of Programming Languages
  2. J. McCarthy, Recursive functions of symbolic expressions and their computation by machine, Comm. ACM 3, 4 (1960) 184-195.
  3. Paul Wilson, Uniprocessor garbage collection techniques.
  4. Benjamin Zorn, Comparing mark-and sweep and stop-and-copy garbage collection, ACM conference on LISP and functional programming, 1990.
  5. Tony Printezis, Garbage Collection in the Java HotSpot Virtual Machine, . For a more technical discussion: here or here.
  6. Stephen M. Blackburn and Kathryn S. McKinley, Immix: A Mark-Region Garbage Collector with Space Efficiency, Fast Collection, and Mutator Performance, ACM SIGPLAN Conference on Programming Language Design and Implementation, 2008.
  7. E. D. Berger, B. G. Zorn, and K. S. McKinley, Composing High-Performance Memory Allocators , ACM SIGPLAN Conference on Programming Language Design and Implementation, 2001.
  8. J. Backus, Can Programming be Liberated from the von Neumann Style?, Comm. ACM 21, 8 (1978) 613-641. (large file)
  9. E. W. Dijkstra, Go To Statement Considered Harmful, Comm. ACM 11, 3 (1968) 147-148. (large file)
  10. D. Ingalls, video lecture on Object-Oriented Programming
  11. 15 Years Ago in BYTE: The Smalltalk Environment by Larry Tessler, BYTE, August 1996.
  12. W.R. Cook, Interfaces and specifications for the Smalltalk-80 collection classes,.Proc ACM Conf. Object-Oriented Programming Systems, Languages, and Applications (OOPSLA '92). ACM SIGPLAN Notices ,Vol. 27, No. 10 (Oct. 1992), Pages 1-15.
  13. Scala:
    A Tour of Scala
    A Brief Scala Tutorial
    Scala By Example
  14. C++
    E. Bendersky, Understanding lvalues and rvalues in C and C++, Dec 2011.
  15. Prolog
    B. Pires, Try logic programming! A gentle introduction to Prolog, Oct 2013.
  16. Learn Prolog Now!

Tutorials

GitHub tutorials

LaTeX tutorials

Unix tutorials

Emacs

Lisp manuals and tutorials

ML manuals and tutorials

Java manuals and tutorials

Scala manuals and tutorials