Programming Languages - CPSC 604 (Spring 2009)

Course Essentials

Course CPSC 604 - Programming Languages, TR 12:45PM-02:00PM ZACH 105B
Instructor Jaakko Järvi
Course pages http://courses.cs.tamu.edu/jarvi/2009/CPSC-604
Contact jarvi@cs.tamu.edu
Office hours By appointment (my office is 416)

News

Apr 2
Info on projects
Mar 26
Assignment 5 is out
Mar 2
Assignment 4 is out
Feb 15
Assignment 3 is out
Feb 3
Assignment 2 is out
Jan 28
Assignment 1 is out

In a nutshell

Study in the design space of programming languages, covering language processing, formalisms to describe semantics of programming languages, important concepts found in current programming languages, and programming paradigms.

Note to a prospective student

Programming languages are an active research area, striving towards ever safer, more efficient, and expressive languages and programming environments. Results from recent programming language research are finding their way to main stream languages, both C# and Java have recently been extended with generics, Java with wildcards, C# with LINQ. C++ is changing signficantly with an addition of constraints to templates. Furthermore, new interesting languages, such as Scala with advanced type systems are being introduced, Spec# combines a theorem prover with a mainstream language, built-in support for representing XML data is being added to several languages. The list goes on and on. For a motivated student, this class is an opportunity to get involved in this exciting research area.

Administrativia

Grading

40% of your course grade will be based on assignments and quizzes, 60% on a research project and/or exams. Participation, or more accurately, lack of it, can influence your grade you achieve otherwise from assignments and on your project or exams, negatively, up to 10%. A grade of 90% or above guarantees an A, 80% or above a B, 70% or above a C, and 60% or above a D.

This grading formula implies that there is no curve; your grade will depend only on how well you do, and not on how well everyone else does. (If everyone does exceptionally badly on some assignment, I may decide the assignment was at fault rather than the students, in which case I'll adjust the grade cutoffs as I deem appropriate. But I won't adjust in the other direction; if everyone gets an A, that's great).

All grade assignments are final—unless there was a mistake made in recording your semester grades or in computing your final grade. If all numbers are correctly recorded and computed, I will not discuss changing the resulting letter grades.

There are situations that may warrant regrading a particular assignment. For example, making addition errors in computing your score, not seeing an answer that you gave, or not understanding an answer that you gave. Requests for regrading of assignments must be made within one week after the graded work has been handed back.

Policies

Academic Integrity Policy: An Aggie does not lie, cheat, or steal or tolerate those who do. The Honor Council Rules and Procedures are available on the web http://www.tamu.edu/aggiehonor.

Americans with Disabilities Act (ADA) Policy: The Americans with Disabilities Act (ADA) is a federal anti-discrimination statute that provides comprehensive civil rights protection for persons with disabilities. Among other things, this legislation requires that all students with disabilities be guaranteed a learning environment that provides for reasonable accommodation of their disabilities. If you believe you have a disability requiring an accommodation, please contact the Department of Student Life, Services for Students with Disabilities, in Room 126 of the Koldus Building or call 845-1637.

Topics

The primary text for the course is:

Benjamin C. Pierce: Types and Programming Languages

Not all of the book will be covered, and other material is used as well, but this book will be necessary to have.

The course aims to deepen understanding on the concepts and features of programming languages, and provide means to (formally) reason about languages and language features, to the extent to become able to appreciate current research and developments in the area of programming languages. Programming languages are a huge area. Consequently, the course tries to focus on fundamental mechanism rather than broadness. Not everything can be covered: the text focuses on static typing, type systems etc., which will comprise the main body of this course as well.

We start from the lambda calculus as the simplest model of a programming language, and gradually extend it with language features. The basics that are covered include

Equipped with this basic skill set, we'll study more ambitious language constructs, such as:

A likely class project will be an in-depth study of an interesting topic covered by the last bullet above.

Projects

Information on projects found here.

Schedule and material

Tue, Jan 20 Introduction / Specifying syntax Slides 1 Slides 2
Thu, Jan 22 Specifying semantics (preliminaries)
Tue, Jan 27 Small-step operational semantics Slides 3
Thu, Jan 29 Crash course on Haskell Slides 4 Test.hs AlgDataType.hs StackADT.hs Main.hs
Tue, Feb 3 More on Haskell. Simple Types Slides 5
Thu, Feb 5 Type safety
Tue, Feb 10 Lambda calculus Slides 6 Fix.hs
Thu, Feb 12 Types and lambda calculus Slides 7
Tue, Feb 17 Types and lambda calculus
Thu, Feb 19 More on Haskell, monads Slides 8
Tue, Feb 24 Monads
Thu, Feb 26 Parser combinators Slides 9
Tue, Mar 3 Parser combinators. About implementations of type checkers
Thu, Mar 5 Subtyping Slides 10
Tue, Mar 10 Subtyping
Thu, Mar 12 References Slides 11
Tue, Mar 17 Spring Break
Thu, Mar 19 Spring Break
Tue, Mar 24 Polymorphism Slides 12
Thu, Mar 26 Midterm
Tue, Mar 31 Polymorphism
Thu, Apr 2 Discussion on projects, Polymorphism
Tue, Apr 7 Existential Types
Thu, Apr 9 Bounded quantification Slides 13
Tue, Apr 14 Generics
Thu, Apr 16 Guest Lecture: C++0x Concepts
Tue, Apr 21 Presentations Jeff
Thu, Apr 23 Presentations Yue, Lantao
Tue, Apr 28 Presentations Cindy, Ian
Thu, Apr 30 Presentations Andria, Suzanne, Henry

Assignments

Assignment 1. This this LaTeX source file may be useful: a1_source.tex, and you may need this to build it Due on Tuesday, 3th of February Example answers
Assignment 2. These files may be useful: Sets.hs, Relations.hs Due on Tuesday, 10th of February
Assignment 3. This file is useful: a3Eval.hs Due on Tuesday, 24th of February
Assignment 4. This tar-ball is useful: a4code.tar Due on Thursday, 12th of March, Example solution
Assignment 5. This tar-ball is useful: a5code.tar Due on Friday, 3rd of April

Exams

Exam is on Thursday, Mar 26th, on normal class hours. Reading for the exam:

Resources

LaTeX

LaTeX is the tool to use for type-setting math or math-related text. Packages that I have found useful include amsmath and amssymb for generally more symbols, and math commands; and mathpartir for type-setting inference rules. The former are part of standard LaTeX distributions. The latter you can find here. The file latex_example.tex is an example file that typesets a few inference rules and derivations with the mathpartir package.

Software

Programming assignments will be done in Haskell, here are a few pointers to get you started:

Material useful for specific assignments:

Using GHC

A few other compilers exist, but we will use the Glasgow Haskell Compiler. An easy way to interact with GHC is to edit your document, say, Foo.hs in your favourite editor (== Emacs, with haskell-mode), and invoke the GHC interpreter in a shell window:

> ghci -fglasgow-exts

The most commonly used commands are

The compiler is invoked, for example as:

> ghci -fglasgow-exts --make

The --make option chases automatically which modules need to be recompiled, so you don't have to write a Makefile yourself. (Also GHC's analysis of what need to be recompiled is more fine grained, thus faster).

GHC and Emacs in linux.cs.tamu.edu

To set up ghc with Emacs, follow the directions below:

  1. Create a .emacs file (if you don't have one)
  2. Add the following to your .emacs
(load "/home/faculty/jarvi/lib/emacs/haskell-mode/haskell-site-file")

(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
(add-hook 'haskell-mode-hook 'turn-on-font-lock)

(add-hook 'haskell-mode-hook
          (function
           (lambda ()
             (setq haskell-program-name "ghci"))))

(setq haskell-ghci-program-args '("-fglasgow-exts"))
  1. Launch emacs, start editing some Haskell file, such as a1.hs.
  2. C-c l launches the interpreter and loads the current file.