COMP 411 Principles of Programming Languages (Spring 2014)

Professor Robert "Corky" Cartwright

Department of Computer Science

Rice University

Houston, Texas, USA

Spring 2014: 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 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 OCaml (using explicit typing) are provided. While Java is a very good vehicle for implementing these interpreters, it is not a good conceptual representation because it is much too wordy and the OO structure obscures the simple algebraic structure of abstract syntax and structural recursion used to defin interpretation.

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 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., Fortran, C, C++, Java, Visual Basic, C#, Perl). 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.

Course Information

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

Assignments

Please refer to the assignments column in the below.

Lectures

Powerpoint slides for selected lectures are available in this directory.

# Date Day Topic Reference Assignment
1 1/13 M Information & Motivation
2 1/15 W Parsing Component Pascal Syntax Diagrams
3 1/17 F Project 1 assigned, 1/17
Reference: Notes on Object-Oriented Program Design
1/20 M Martin Luther King Holiday
4 1/22 W The Scope of Variables PLAI, ch. 3-4
5 1/24 F Syntactic Interpreters
6 1/27 M Brief Review of Lectures 1-6 Project 1 due at noon, 1/27
Project 2 assigned, 1/27
7 1/29 W A Meta Interpreter for LC Eliminating Meta-errors PLAI, Ch. 4-6
8 1/31 F
9 2/3 M
10 2/5 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/7 F
12 2/10 M Project 2 due 12 noon, 2/12
Project 3 assigned, 2/12
13 2/12 W Recursive Binding
14 2/14 F Eliminating Binding (lambda) Essentials, ch. 3.7, 3.9
Hand Evaluation Exercises
Solution to Hand Evaluation Exercises
15 2/17 M Assignment and Mutability
16 2/19 W
16 (cont.) 2/21 F
17 2/24 M 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/24
Project 4 and 4xc assigned, 2/24
18 2/26 W
19 2/28 F Object-Oriented Languages Essentials, ch. 5
3/3-3/7 M-F Spring Break — No Classes
Exam 1 Review 3/10 M Sample Exam 1
Solutions to Sample Exam 1
Binding/bound occurrences, Problem 3
Call-by-name hand evaluation, Problem 5(i)
Call-by-value hand evaluation, Problem 5(ii)

Essentials, ch. 3.8 Exam 1 distributed in class, 3/10, due at beginning of class, 3/17
Exam 1 Review (cont.) 3/12 W
20 3/14 F What Is a Type?
Types and Safety
Types and Datatype
Essentials, ch. 4
Essentials, ch. 6
Type Inference Study Guide

Project 4 due 12 noon, 3/14
Project 5 and 5xc assigned, 3/14
21 3/17 M Exam 1 due in class, 3/17
22 3/19 W Polymorphism
Implicit Polymorphism
3/21 F Exam Discussion Project 4xc due 12 noon, 3/21
23 3/24 M Final Words on Types
24 3/26 W Meaning of Function Calls Essentials, ch. 7-8
25 3/28 F Continuation-Passing Style
26 3/31 M Explaining letcc and error
27 4/2 W Project 5 and 5xc due 12 noon, Wednesday, 4/2
Project 6 (PDF) assigned, Wednesday, 4/2
4/4 F Spring Recess
28 4/7 M Dynamic Storage Allocation Survey
29 4/9 W Garbage Collection Uniprocessor Garbage Collection Techniques
4/11 F
4/14 M
30 4/16 W Project 6 (PDF) due, Wednesday, 4/16
Project 7 assigned, Wednesday, 4/16
29 4/18 F Exam 2 handed out in class, Monday,4/21
30 4/21 M Sample Exam 2
Sample Exam 2 With Solutions
31 4/23 W
4/25 F Exam 2 due at 11:59 PM, 4/25
Project 7 due at 11:59 PM, 4/25

Language Resources

  1. Java
    1. SDK Download
    2. Generic Java Documentation
    3. API Reference
    4. DrJava Programming Environment
    5. Elements of Object-Oriented Program Design by Prof. Cartwright
  2. Scheme (Racket)
    1. How to Design Programs
    2. DrRacket Programming Environment
  3. OCaml
    1. OCaml Book
    2. O'Caml Language
    3. MetaOCaml
    4. OCamlLex
    5. Using "Ledit" to make Ocaml recognize arrow keys
  4. Haskell
  5. Scala

Additional References

  1. Krishamurthi, Shriram. Programming Languages: Application and Interpretation. Online at http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/. 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. The Java Virtual Machine. The most basic expository articles appear at the end of the index. Read it from bottom up.
  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. Concurrency in Swing Text
  19. The Last Word in Swing Threads
  20. 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.