CS 381: Programming Language Fundamentals (Spring 2014)


Course Description

CS 381, Programming Languages, is a four-credit course for undergraduate students. This course gives an introduction to the concepts found in a variety of programming languages and to languages from a number of different paradigms. Topics to be covered are: Haskell, Prolog, scoping, parameter passing, types, polymorphism, exception handling, semantics.

Contents of this web page:

Classroom Policies

We have over 110 students in this class. To support a more focused learning experience for everyone in such a big class, I ask you to adhere to the following rules during lectures.

Prerequisites

This class assumes background knowledge about the following concepts: Data structures and discrete math should have been covered in your previous classes, but maybe you have never seen a formal definition of a grammar. I will explain grammars in class, but I encourage you to read about grammars in advance. Could do this on the above referenced web site and/or in the textbook, Chapter 4.1.2.

Back to the table of contents

Background Reading

This class does not use a specific textbook. However, I recommend as backup reading material the following book.
Concepts in Programming Languages
By John C. Mitchell, Cambridge University Press 2003.

This textbook is, however, not required. All relevant material will be presented on my slides that will be accessible here.

Back to the table of contents

Haskell

Most programming will be done in Haskell, a modern functional programming language. In particular, we will use Haskell as a formal notation to explain concepts of programming languages. It is therefore absolutely essential that you acquire profound programming skills in Haskell! I will introduce Haskell alongside with programming language concepts during the first seven weeks of the class. To become confident in writing Haskell programs, you should work on all the (non-graded) small programming assignments that I will give during class. A lot of information on Haskell (documentation, textbooks, compilers, examples, ...) can be found on the following website.
haskell.org

Here are some tutorials:

The definitive reference for all questions regarding Haskell is the Haskell Report, which includes a complete language definition.

We will use the GHC interpreter, which is available on many different platforms. It is already installed on the CS and ENGR machines, but in general only on Unix.

To start the GHC interpreter, just enter ghci in the Unix shell. In GHCi, enter :? for help on commands; enter :q to quit the interpreter.

Here is a file that you might want to use (and customize) for testing your programs.

TestScript.hs
I have also put an introductory Haskell textbook on reserve in the Valley library:

Haskell: The Craft of Functional Programming
By Simon Thompson. Addison-Wesley, 3rd ed., 2011.

Back to the table of contents

Haskell Exercises

Here are two sets of exercises that help you learn how to define data types and functions on data types and with the programming with lists.

Back to the table of contents

Prolog

Information about Prolog is also available on the Internet, see the links provided here. We will be using SWI-Prolog.

Back to the table of contents

Slides and Programs

Except for the very first lecture, I will try to make the slides available online before each lecture, but be aware that there might be some last-minute changes.

Topic Slides Update Code and other supporting material
0. Introduction [pdf] 04/01/14
1. Haskell [pdf] 04/03/14 Currying.pdf WhyParadigms.pdf Intro.hs
2. Syntax [pdf] 04/15/14 SentSyn.hs SentPP.hs BoolSyn.hs BoolPP.hs Stmt.hs Bin.hs Reg.hs ExprSyn.hs
3. Semantics [pdf] 04/20/14 swap.c BoolSem.hs ExprSem.hs Shape.hs ShapePP.hs Move.hs Move2.hs ExprErr.hs Expr2.hs RegMachine.hs RegMachine2.hs
4. Types [pdf] 04/24/14

Back to the table of contents

Homework

Note: Late submissions will not be accepted!
  1. Abstract Syntax [pdf] (Version 04/19/14) Due date: 04/22/14 (2pm)
    An example illustrating a function definition to generate syntax trees: GenExpr.hs (which imports ExprSyn.hs)
  2. Semantics [pdf] (Version 04/22/14) Due date: 05/01/14 (2pm)
    Definitions to render Mini Logo results: SVG.hs
  3. Types
  4. Runtime Stack, Scoping, and Parameter Passing
  5. Prolog

Back to the table of contents

Grading (Homework)

Grading (General)

Grades will be roughly computed as follows: For 90% or more, you get an A; for less than 30% you get an F. The remaining grades in between are assigned linearly. I might lift individual grades if clustering of points achieved by students suggests so (but I won't assign grades worse than indicated by the above linear schema). If you are too lazy to calculate, you can look up grades in this table.

Grading Results

I will hand out corrected homework and exams in class. If you should miss that lecture, you can get your homework during my office hour. Due to the large number of students in the class I plan to have you pick up your quizzes and exams yourself from a pile of exams at the beginning/end of lectures. I do respect your privacy, and if you prefer to have your quiz/exam handed back to you personally, please send me an email. In that case I will not return your exam in class and keep it in my office for you to pick up in person.

Quiz/ExamGrade Distribution
    A       B or better     Median/Average  
Quiz 119%37%C/C
Quiz 214%42%B-/B-

Back to the table of contents

Important Dates and Times (Office hours, TAs, Quizzes, Exams)

See Syllabus

Back to the table of contents


last change: April 23, 2014 Martin Erwig  erwig@eecs.oregonstate.edu