Programming Languages - CPSC 314 (Fall 2008)

Course Essentials

Course CPSC 314 - Programming Languages, MWF 03:00PM-03:50PM HRBB 113
Instructor Jaakko Järvi
Course pages http://courses.cs.tamu.edu/jarvi/2008/CPSC-314
Contact jarvi@cs.tamu.edu
Office hours By appointment (my office is 416)
Prerequisite CPSC 221.
Teaching Assistant Jacob Smith, thechao@cs.tamu.edu
Peer Teacher Justin Schwartzbeck, justinschw@neo.tamu.edu (office hours: TR 11:00AM-12:00PM, 214 (OAL))

News

Current grades

Info on the final exam

Nov 25
Assignment 8 is out
Nov 9
Assignment 7 is out
Oct 28
Assignment 6 is out
Oct 12
Assignment 5 is out
Sep 27
Assignment 4 is out
Sep 15
Assigment 1 grades
Sep 14
Assignment 3 is out.
Sep 8
Assignment 2 updated (small fixes that may help clear confusion, so please re-download the assignment)
Sep 5
Assignment 2 is out.
Aug 28
Assignment 1 is out.

In a nutshell

Explores the design space of programming languages via an in-depth study of two programming languages, one object-oriented (Java), one functional (Haskell); focuses on idiomatic uses of each language, and on features characteristic for each language.

Administrativia

Grading

Current grades

30% of your course grade will be based on assignments and quizzes 35% on the mid-term and 35% on the final exam. 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 or exam, I may decide the assignment or exam 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

We use the following Haskell book, it is required:

Graham Hutton: Programming in Haskell, Cambridge University Press.

In addition, you will need some Java book (regarded as more of reference material), such as:

Java(TM) Programming Language, by James Gosling, Ken Arnold and David Holmes; 4th edition, Prentice Hall, 2006.

Other recent books about Java are suitable as well. Not all of the books will be covered, and other material is used as well.

The course aims to deepen understanding on the concepts and features of programming languages, and how programming languages work. After a general overview of language processing, we study the features of Haskell, focusing on what constitutes a functional programming language. Non-exhaustive list of what follows is:

Along the way, we cover the basic ingredients of a programming language implementation, including:

We use Haskell to implement a small imperative programming language as course assignments.

The Java portion of the class focuses on the major features of a modern object-oriented programming language, and focuses on interesting language features and the language infrastructure of Java, including:

Programming languages are a very large area. The course aims at providing an understanding of the use, efficiency considerations, and implementation approaches of common abstraction mechanisms and language constructs in modern programming languages. I hope that the course will allow you to more effectively use the languages of today, make it easier for you to learn new programming languages in the future, and possibly get excited about contributing to research and development in the area of programming languages in the future. Even though we use and study two specific programming languages, Haskell and Java, learning more of these languages should be considered as a nice side benefit of the course, not the main goal.

Schedule and material

Mon, Aug 25 Introduction Slides 1: pdf 4up.pdf Slides 2: pdf 4up.pdf
Wed, Aug 27 Haskell & Functional Programming Basics Slides 3: pdf 4up.pdf
Fri, Aug 29 Pre-test / Haskell & Functional Programming Basics
Mon, Sep 1 Haskell & Functional Programming Basics
Wed, Sep 3 Pattern matching, comprehensions, higher-order functions
Fri, Sep 5 continues Slides 4: pdf 4up.pdf
Mon, Sep 8 continues
Wed, Sep 10 Defining types Slides 5: pdf 4up.pdf
Fri, Sep 12 Class cancelled due to Ike
Mon, Sep 15 Defining types
Wed, Sep 17 Syntactic analysis Slides 6: pdf 4up.pdf
Fri, Sep 19 Syntactic analysis
Mon, Sep 22 Modules Slides 7: pdf 4up.pdf
Wed, Sep 24 Functional Parsers Slides 8: pdf 4up.pdf
Fri, Sep 26 Functional Parsers, implementing Clite parser
Mon, Sep 29 IO and Monads Slides 9: pdf 4up.pdf
Wed, Oct 1 IO and Monads
Fri, Oct 3 Monads
Mon, Oct 6 Types and type checking Slides 10: pdf 4up.pdf
Wed, Oct 8 Types and type checking
Fri, Oct 10 Types and type checking
Mon, Oct 13 Specifying a type system
Wed, Oct 15 Implementing a type checker
Fri, Oct 17 Monads/review
Mon, Oct 20 Functions, activation records, etc. Slides 12: pdf 4up.pdf
Wed, Oct 22 Midterm
Fri, Oct 24 Interpreters
Mon, Oct 27 Specifying operational semantics Slides 11: pdf 4up.pdf
Wed, Oct 29 Specifying operational semantics
Fri, Oct 31 OO basics Slides B1: pdf 4up.pdf
Mon, Nov 3 OO basics
Wed, Nov 5 Domain Specific Languagges (Taha)
Fri, Nov 7 OO basics
Mon, Nov 10 Generics and OO Slides B2: pdf 4up.pdf
Wed, Nov 12 Generics and OO
Fri, Nov 14 Generics and OO (Wildcards)
Mon, Nov 17 Type Erasure and it implications, Java Concurrency
Wed, Nov 19 Java Concurrency
Fri, Nov 21 Java Concurrency
Mon, Nov 24 Java Concurrency Slides B5: pdf 4up.pdf, Code from class
Wed, Nov 26 No class
Fri, Nov 28 No class — thanksgiving
Mon, Dec 1 (one possible) direction for future languages

Assignments

Assignment 1 Due on Friday, 5th of September
Assignment 2 New due date: Tuesday, 16th of September
Assignment 3 (You will also need this file) Due on Wednesday, 24th of September
Assignment 4 (You will also need this file) Due on Monday, 6th of October
Assignment 5 (You will also need this file) Due on Friday, 24th of October
Assignment 6 (You will also need this file) Due on Friday, 7th of November
Assignment 7 Due on Wednesday, 19th of November
Assignment 8 Due on Thursday, 4thth of December

Exams

Second (final) exam is on December 9, Tuesday 10:30 a.m.-12:30 p.m.

Material to study include all slides and notes from class (since the midterm) and all assignments (since the mid-term). It is worth the while to study subtyping and subclassing in Java, generics and wildcards, and concurrency in Java.

Here are some material regarding these topics, that you should consider spending some time with.

Resources

Software

Many programming assignments will be done with 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.