COMP 411/511 Principles of Programming Languages (Spring 2018)

Professor Robert "Corky" Cartwright

Department of Computer Science

Rice University

Houston, Texas, USA

Spring 2018: Room 1070, Duncan Hall, Monday, Wednesday, Friday, 1:00pm–1:50pm

For more information on the course staff including office hours, see course information.


Course News

Summary

COMP 411/511 is an introduction to the principles of programming languages. It focuses on:

In the lecture materials, interpreters are written in concise functional notation using Scheme (Racket). In some cases, supplementary material showing how the same interpreters can be written in Scala (using explicit typing) are provided. The functional subset of Scala and the ML family of languages (notably OCaml) are very well-suited to writing purely functional interpreters, yet they support the limited use of mutation (imperativity) as well. I question their suitability of the ML family for writing larger software systems because they do not support inheritance and object-oriented design. In conrast, Java is a very good vehicle for implementing these interpreters including imperative optimization code, it is not a good representation for explaining abstract concepts because it is much too wordy and the OO structure obscures the simple algebraic structure of abstract syntax and structural recursion used in simple interpreters.

A secondary theme is software engineering. All of the programming assignments in this course are conducted in Java using test-driven development and pair-programming, two of the major tenets of Extreme Programming.

COMP 411/511 consists of three parts:

The course enables students to analyze the semantics and pragmatics of the old, new, and future programming languages that they are likely to encounter in the workplace (e.g., C, C++, Java, JavaScript, Swift, C#, Python). They will also be able to build efficient interpreters for new languages or for "special-purpose" languages embeded in software applications. Finally, they will be much better equipped as software developers because they will understand how to define and implement whatever linguistic extensions are appropriate for simplifying the construction of a particular software system.

Notes on the common mathematifcal notation used in operational semantics, some of which will be used in class.

Differences between COMP 411 and COMP 511

COMP 511 includes all of the material from COMP 411. Portions of projects 1, 3 and 6 are optional for 411 students, but are required for 511 students.

COMP 511 students are also required to complete 3 short written assignments over the course of the semester, discussing concepts from the lectures.

More Course Information

Please take a look at the course information/policies page, some of which was discussed during the first few class lectures.

Course Schedule

# Date Day Topic Reference Assignment
1 1/08 M Information & Motivation
2 1/10 W Parsing Web site describing Syntax Diagrams
Note: EBNF notation is explained in Project 1.
Component Pascal Syntax Diagrams
Tutorial on Context Free Grammars
The Java Language Specification
3 1/12 F Project 1 assigned, 1/12
1/15 M Martin Luther King Holiday
4 1/17 W The Scope of Variables PLAI, ch. 3-4
5 1/19 F Syntactic Interpreters
6 1/22 M Brief Review of Lectures 1-6 Project 1 due at noon, 1/24 Project 2 assigned, 1/24
Reference: Notes on Object-Oriented Program Design
7 1/24 W A Meta Interpreter for LC Eliminating Meta-errors PLAI, Ch. 4-6
8 1/26 F
9 1/29 M
10 1/31 W Data Domains Supporting Recursive Definitions

Recursive Definitions and Environments

Domain Theory: An Introduction
The Why of Y
Recursive Programs as Definitions in First-Order Logic
Types as Intervals
The Lambda Calculus as a Model of Computation
Supplemental Material
11 2/2 F
12 2/5 M
13 2/7 W Recursive Binding Project 2 due 12 noon, 2/7
Project 3 assigned, 2/7
2/9 F Spring Recess
14 2/12 M Eliminating Binding (lambda) Essentials, ch. 3.7, 3.9
Hand Evaluation Exercises
Solution to Hand Evaluation Exercises
15 2/14 W Assignment and Mutability
16 2/16 F
16 (cont.) 2/19 M
17 2/21 W Run-time Environment Representation and Control Essentials, ch. 7, 8
Powerpoint slides taken from Sebesta's book Concepts of Programming Languages

Project 3 due 12 noon, 2/21
Project 4 and 4xc assigned, 2/21
Comp 511 Written Assignment 1, assigned 2/21
18 2/23 F
2/26 M
19 2/28 W Object-Oriented Languages Essentials, ch. 5
Midterm Review 3/2 F Sample Midterm Exam
Solutions to Problems 1, 2, 4, 6
Solution to Problem 3
Solution to Problem 5(i)
Solution to Problem 5(ii)

Essentials, ch. 3.8 Comp 511 Written Assignment 1, due 11:59pm 3/2
3/5 M
Project 4 due 12 noon, 3/5
Project 5 and 5xc assigned, 3/5
3/6 Tu Mid-term Examination 7-10pm in Keck (the old Chemistry Building) 100
20 3/7 W What Is a Type?
Types and Safety
Types and Datatype
Essentials, ch. 4
Essentials, ch. 6
Type Inference Study Guide
21 3/9 F
3/12-3/16 M-F Spring Break — No Classes
22 3/19 M Polymorphism
Implicit Polymorphism
Project 4xc due 12 noon, 3/19. NOTE: the due date for this assignment has been EXTENDED until 12 noon 3/21.
23 3/21 W Final Words on Types Comp 511 Written Assignment 2, assigned 3/21
24 3/23 F Meaning of Function Calls Essentials, ch. 7-8
25 3/26 M Continuation-Passing Style
26 3/28 W Explaining letcc and error
27 3/30 F Project 5 and 5xc due 12 noon, 3/30
Project 6 assigned, 3/30
28 4/2 M Dynamic Storage Allocation Survey Comp 511 Written Assignment 2, due 11:59pm 4/2
29 4/4 W Garbage Collection Uniprocessor Garbage Collection Techniques
4/6 F
4/9 M Comp 511 Written Assignment 3, assigned 4/9
30 4/11 W Project 6 due 12 noon 4/11
Project 7 assigned, 4/11
4/13 F Sample Final Exam
Sample Final Exam With Solutions
4/16 M
4/18 W
4/20 F Project 7 due 11:59pm 4/20
Comp 511 Written Assignment 3, due 11:59pm 4/20

Language Resources

  1. Java
    1. SDK Download
    2. API Reference
    3. DrJava Programming Environment
    4. Elements of Object-Oriented Program Design by Prof. Cartwright
  2. Scheme (Racket)
    1. How to Design Programs
    2. DrRacket Programming Environment
  3. Browser-based reference Jam interpreter

Additional References

  1. Krishamurthi, Shriram. Programming Languages: Application and Interpretation. This book is a descendant of lecture notes created by Shriram for a version of this course when Shriram was a teaching assistant over a decade ago.
  2. Friedman, Wand, and Haynes, Essentials of Programming Languages, 2nd ed. (MIT Press, 2001)
    You can take a look at the following two chapters, which the authors prepared for the second edition, without buying the book:
    1. Parameter Passing ( local file, PDF)
    2. Types and Type Inference ( local file, PDF)
  3. Evaluation rules for functional Scheme ( PDF)
  4. References on evaluating Jam programs
  5. Lecture Notes on Types I
  6. Lecture Notes on Types II
  7. Introduction to System F (Polymorphic Lambda-Calculus)
  8. Scheme code from Class Lectures
  9. The Essence of Compiling with Continuations by Flanagan et al.
  10. Uniprocessor Garbage Collection Techniques by Paul Wilson
  11. Garbage Collection [canonical textbook] by Jones and Lins
  12. Space Efficient Conservative Garbage Collection by Hans Boehm ( local file, PDF)
  13. Hans Boehm's Conservative GC Webpage
  14. JVM Performance Optimization. The first article in a five part series (with the remaining four parts linked from the first article) on JVM internals and how to write Java source code to use them efficiently.
  15. Java Memory Model
  16. Revised Thread Synchronization Policies in DrJava (doc) ( pdf). Since DrJava is built using the Java Swing library, it must conform to the synchronization policies for Swing. Unfortunately, the official Swing documentation is sparse and misleading in places, so this document includes a discussion of the Swing synchronization policies.
  17. Lesson: Concurrency in Swing. This lesson discusses concurrency as it applies to Swing programming. It assumes that you are already familiar with the content of the Concurrency lesson in the Essential Classes trail.
  18. Java concurrency (multi-threading): Tutorial. A tutorial on expressing concurrent computation in Java using threads.
  19. The Last Word in Swing Threads. An article on the perils of accessing Swing components from outside the event dispatch thread.
  20. Why Functional Programming Matters (as analyzed in 1990).
  21. Why Functional Programming Mattered (gazing at programming technology in 2017).
  22. Old Course Website

Accomodations for Students with Special Needs

Students with disabilities are encouraged to contact me during the first two weeks of class regarding any special needs. Students with disabilities should also contact Disabled Student Services in the Ley Student Center and the Rice Disability Support Services.