314-CSCE Programming Languages


Course Essentials

CourseCSCE 314 – Programming Languages, MWF 09:10 am – 10:00 am, RICH 101
InstructorJaakko Järvi
Course pageshttp://courses.cse.tamu.edu/jarvi/2010/CSCE-314
Office hoursBy appointment (my office is 416)
PrerequisiteCPSC 221.
Teaching AssistantXiaolong Tang (xiaolong@cse.tamu.edu), office hours: MWF 10:10 am – 11:00 am, 414D HRBB
Peer TeacherChirs Harris (ceh2210@neo.tamu.edu)


[Thu Dec 2 11:45:14 2010] :: Assignment 9 is out.

[Thu Nov 18 17:32:21 2010] :: Assignment 8 is out.

[Thu Nov 11 23:30:22 2010] :: Assignment 7 is out.

[Tue Nov 2 23:53:26 2010] :: Assignment 6 is out.

[Sun Oct 24 13:50:06 2010] :: Assignment 5 is out.

[Thu Sep 23 19:26:14 2010] :: Midterm will be on Wed, Oct 13th.

[Thu Sep 23 17:23:36 2010] :: Assignment 3 is out.

[Mon Sep 20 13:38:21 2010] :: Assignment 2 deadline postponed to Tuesday, Sep 21st. (and fixed to be in September, not in October, as most guessed)

[Sun Sep 12 21:53:02 2010] :: Assignment 2 is out

[Sun Sep 12 21:33:40 2010] :: Assignment 1 deadline was extended until Monday night.

[Sun Sep 5 22:08:57 2010] :: 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.



Current grades

20% of your course grade will be based on assignments and quizzes 40% on the mid-term and 40% 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.

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.


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.


We use the following Haskell book:

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:

  • Types, static typing and type inference
  • Parametric polymorphism
  • Higher-order functions, closures
  • Recursive types and functions
  • Algebraic data types
  • Abstract data types and modules
  • Type classes
  • Effects in a ``pure'' language

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

  • Grammars, lexing and parsing
  • Abstract syntax, internal representations
  • Types and type checking
  • Interpretation, optimization, code generation

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:

  • Subtyping and inheritance
  • Subtype polymorphism
  • Exception handling
  • Generics, wildcards
  • Reflection
  • Concurrency

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 30IntroductionSlides 1 Slides 2
Wed, Sep 1Haskell & Functional Programming BasicsSlides 3
Fri, Sep 3Haskell & Functional Programming Basics
Mon, Sep 6Haskell & Functional Programming Basics
Wed, Sep 8Haskell & Functional Programming BasicsSlides 4
Fri, Sep 10Pattern Matching
Mon, Sep 13List Comprehensions, higher-order functionssimple_io.hs
Wed, Sep 15Higher-order functions, data typesSlides 5
Fri, Sep 17Defining Data types, simple io
Mon, Sep 20Data types, Type classes
Wed, Sep 22Syntactic AnalysisSlides 6
Fri, Sep 24Syntactic Analysis, Haskell ModulesSlides 7
Mon, Sep 27Functional ParsersSlides 08
Wed, Sep 29Functional Parsers, MonadsExprParser.hs ExprParserDo.hs
Fri, Oct 1Functional Parsers, MonadsSlides 9
Mon, Oct 4IO, Monadsio.hs
Wed, Oct 6IO, Monads
Fri, Oct 8Monads
Mon, Oct 11ReviewReview slides
Wed, Oct 13Midterm
Fri, Oct 15Parsing, assignment 4
Mon, Oct 18Types and type-checkingSlides 10
Wed, Oct 20Types and type-checking
Fri, Oct 22Implementing a type checker
Mon, Oct 25Implementing a type checkerWriter.hs Reader.hs Error.hs State.hs
Wed, Oct 27Operational semanticsSlides 11
Fri, Oct 29Object-oriented programmingSlides J1
Mon, Nov 1Object-oriented programming
Wed, Nov 3Object-oriented programming
Fri, Nov 5Object-oriented programming
Mon, Nov 8Java GenericsSlides J2
Wed, Nov 10Java Generics
Fri, Nov 12Java Generics
Mon, Nov 15Co/contravariance, wildcards
Wed, Nov 17Type Erasure. Concurrency in Java
Fri, Nov 19Concurrency in JavaSlides J5
Mon, Nov 22Concurrency in JavaExample code
Wed, Nov 24Concurrency
Fri, Nov 26Thanksgiving: no class
Mon, Nov 29Reflection in JavaSlides J3
Wed, Dec 1Java virtual machineSlides J6
Fri, Dec 3Review, misc.
Mon, Dec 6Java virtual machine

Useful reading


Assignment 1 example answerDue on Monday, 13th of September
Assignment 2 example answerDue on Tuesday, 21th of September
Assignment 3 a3.tarDue on Friday, 1st of October
Assignment 4 a4.tarDue on Thursday, 21st of October
Assignment 5 a5.tarDue on Sunday, 31st of October
Assignment 6 a6.tarDue on Wednesday, 10th of November
Assignment 7Due on Wednesday, 17th of November
Assignment 8Due on Wednesday, 24th of November (no extensions!!!)
Assignment 9Due on Friday, 10th of December


There will be two exams, Midterm and Final. The midterm focuses on the Haskell portion of the class, the final exam on the Java portion. More information will be provided later.

The first exam will be on Wedesday, Oct 13th, during regular class hours. Exam is based on lectures and discussions in class, all slides, assignments 1–4, and chapters 1–10 and 12 from the Haskell book.



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

  • :l Foo to load the module Foo (from your file Foo.hs)
  • :r to re-load the previously loaded module
  • :i x to inspect the value, type, … x
  • :q to quit the interpreter

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 
           (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.

Author: Jaakko Jarvi

Date: 2010-12-07 17:30:00 CST

HTML generated by org-mode 7.01trans in emacs 23