Concepts in Programming Languages
By John C. Mitchell, published by Cambridge University Press 2003.
I will also provide access to my slides.
haskell.orgThere you will also find links to several tutorials. You might start by looking at the short summary. In the class schedule I will refer to sections of the so-called A Gentle Introduction (which is actually not so gentle after all, but provides a concise and comprehensive summary). I have also put an introductory a textbook and the Haskell Report (the latter is not suited for beginners) on reserve in the library to provide additional information on Haskell:
Haskell: The Craft of Functional Programming
By Simon Thompson. Addison-Wesley, 1999.
Haskell 98 Language and Libraries: The Revised Report
Edited by Simon Peyton Jones. Cambridge University Press, 2003.
We will mainly use the ghci interpreter, which is available on many different platforms. It is already installed on the CS and ENGR machines, but only on Unix. Just enter ghci in the Unix shell. In ghci, enter :? for help on commands; enter :q to quit the interpreter.
Information about Prolog is also available on the Internet, see the links provided here. We will be using SWI-Prolog.
| Week | Date | Topics | Prepare/Rework |
|---|---|---|---|
| 1 | June 20 | Introduction, Haskell: Values, Types, Expressions, Tuples | H2, 5.4.1 |
| June 21 |
Haskell: Lists, Functions | H2, H3, 3.4.3, 5.4.2 (Lists), 2.1.2, 3.4.5, 3.4.6, 4.2.1 (Functions) | |
| June 22 |
Haskell: Lists, Functions (cont) | H2, H3, 3.4.3, 5.4.2 (Lists), 2.1.2, 3.4.5, 3.4.6, 4.2.1 (Functions) | |
| June 23 | Haskell: Definitions, (Lazy) Evaluation, Higher-Order Functions | H3, 5.4.3, 3.4.7 |
|
| 2 | June 27 | (Lazy) Evaluation, Higher-Order Functions, Types | H2.3, H3, 3.4.7 |
| June 28 | Types, Parametric Polymorphism |
H2.3, H3, 6.4 | |
| June 29 |
Data Types, Pattern Matching |
H2.2, H4-H4.3, 5.4.4 |
|
| June 30 | Continued |   | |
| 3 | July 5 | Data Types, Pattern Matching (continued) |
H2.2, H4-H4.3, 5.4.4 |
| July 6 | Type Classes | H5 | |
| July 7 | Type Classes | H5 | |
| 4 | July 11 | Block Structure and Scope, Activation Records | 7.1, 7.2, 7.3.1, 7.3.3 |
| July 12 | continued |   | |
| July 13 | Review of HW1 |   | |
| July 14 | Parameter Passing, Exceptions | 7.3.2, Exercise 7.6, 5.1.1, 8.2, 13.3.4, TestFinally.java | |
| 5 | July 18 | Continued |   |
| July 19 | Languages and Interpreters | 4.1.2, Expr.hs, Expr2.hs, TypeCheck.hs | |
| July 20 | Languages and Interpreters |   | |
| July 21 | Midterm | Sample solution | |
| 6 | July 25 | Type Checking | MILtc.hs |
| July 26 | Type System | 6.1, 6.2 | |
| July 27 | Type Checking | MILtc.hs | |
| July 28 | Type Checking | 6.4, 13.3.5 MILtcN.hs | |
| 7 | Aug 1 | Semantics |   |
| Aug 2 | Denotational Semantics | 4.2 Sem.hs | |
| Aug 3 | Operational Semantics |   | |
| Aug 4 | Prolog: Predicates, Goals, and Rules | 15 | |
| 8 | Aug 8 | Prolog: Backtracking, Terms and Lists | |
| Aug 9 | Prolog: The Cut, Operational Semantics | opsem.pl | |
| Aug 10 | Prolog examples | examples.pl | |
| Aug 11 | FINAL EXAM | Solution |
1. Introduction [pdf] 2. Haskell [pdf] 3. Scope & Parameters [pdf] 4. Exceptions [pdf] 5. Languages and Interpreters [pdf] 6. Types [pdf] 7. Semantics [pdf] 8. Prolog [pdf]
Here I collect definitions and explanations for some terms and topics that might be difficult to understand or to remember and for which there is no explicit definition given on the slides or in the textbook. I also try to add explanations for frequently asked questions by students. If somebody would like to have something added, please let me know (it would be great if you tried a definition yourself!). Also if you find errors or have other suggestions for improving this reference list, please send me an email.
man(adam).defines a predicate man. Even in one goal you can use terms and predicates of the same name at the same time. For example, the following goal asks whether the predicate man is true for the term man(adam) and for the atom adam.
man(X) :- ...
man(man(adam)), man(adam).Notice that the first and third occurrence of man are as predicate names, whereas the second use of man is as a functor. Similarly, the first expression man(adam) is a term (as an argument of the predicate man), whereas the second expression man(adam) is a goal. Note that there are no declarations of functors, unlike in Haskell where constructors have to be declared in data type definitions.
A source of possible confusion is the fact that Prolog terms are used to represent two different things: (i) structured objects (terms) and (ii) programs (predicates), and there is no name space distinction between the two. Hence, if you use terms to represent structured objects or to just tag or mark objects (like var(x)), you usually won't have rules for these terms. Rather these terms are used in your program as patterns of other predicates.
| Class Time: | Mon-Thur |
12:00pm - 1:00pm | Rogers 230 |
| Office hours: | Monday | 1:00pm - 2:00pm |
Dear 115 |
| Tuesday | 11:00am - 12:00pm |
Dear 115 |
|
| Wednesday | 11:00am - 12:00pm | Dear 115 |
|
| Midterm Exam: | Thursday, July 21st. |
12:00pm-1:00pm | Rogers 230 |
| Final Exam: | Thursday, Aug 11th. |
12:00pm-1:00pm |
Rogers 230 |