CS 15-312: Foundations of Programming Languages
(Spring 2009)
|
|
About this course
[ Description
| Prerequisites
| Readings
| Software
| Grading
| Assessment
]
This course has the purpose of exposing students who have mastered advanced
programming techniques and concepts to some of the foundational principles
that underly the very programming languages they have been using. These same
principles pervade many disciplines in and beyond Computer Science and can be
found any time one needs to give and work with a representation of some
domain. More specifically,
- You will see that a (good) programing language is not an ad-hoc collection
of constructs, but a mathematical object whose external features
(including expressiveness and usability) are the necessary manifestation
of intrinsic properties. We will use judgments and derivations as a
universal vehicle to talk and reason about language constructs.
- You will learn some of these general design principles, for example the
use of types as an organizing principle, safety proofs as a measure of
correctness, and the orthogonality of constructs, and study how they
apply to the most common programming mechanisms, such as functions,
records, variants and recursion, as well as to more specialized or
esoteric concepts, such as polymorphism, exceptions, inheritance and
concurrency. This will provide you with the tools to knowledgeably design
your own language if the occasion arises.
- You will see that these same principles can be used to derive efficient
and correct implementations techniques for a language. In particular,
we will be able to establish correctness mathematically.
See also Why
Study Programming Languages?
This course will be coordinated with the edition currently offered on the
main campus, taught by Professor Robert Harper. The material presented
and the homeworks will be roughly the same.
You must have completed CS 15-212
(Principles of Programming)
The course will closely follow Harper's book. Note
that it is work in progress and is being continuously updated. Therefore, you
are advised to print chapters before the relevant lecture (see schedule) rather than all at once on the first
day of class.
Further References
- Benjamin Pierce,
Types and Programming
Languages ,
MIT Press, 2002
- Benjamin Pierce, editor,
Advanced Topics in
Types and Programming Languages,
MIT Press, 2005.
- John Reynolds,
Theories of Programming Languages,
Cambridge University Press, 1998.
The course has a programming component, mainly in the form of 4 programming
assignments. Students are allowed to use any programming language they want
to develop their solution to these assignments. The only requirements are
that the solution work as per the text of the assignment, be understandable to
the instructors, and that the student be able to explain it. Said this, some
programming languages will make the task simpler than others. In particular,
using Standard ML (SML)
and similar languages, or Twelf and similar languages, is likely to
get you a working solution in a much shorter time than, say, Java or C.
SML
A reference build of Standard
ML of New Jersey (SML/NJ), version 110.67, and Concurrent ML (CML) have
been made available on the Unix clusters. To run it, you need to login into
your Unix account. In Windows, you do this by firing PuTTy and specifying
unix.qatar.cmu.edu as the machine name. When the PuTTy window
comes up, type sml, do your work, and then hit CTRL-D when you
are done.
You can edit your files directly under Unix (the easiest way is to run the
X-Win32 utility from Windows and then run the Emacs editor from the PuTTy
window by typing emacs - see also this tutorial). If
you want to do all this from your own laptop, you first need to install
X-Win32 from here.
PuTTy is pre-installed in Windows.
If you want, you can install a personal copy of SML/NJ on your laptop. To do
this, download this
file and follow these
instructions. Personal copies are for your convenience: all ML programs
will be evaluated on the reference environment on
unix.qatar.cmu.edu. You need to make sure that your homework
assignments work there before submitting them. To do so, you need to transfer
your files onto unix.qatar.cmu.edu and test them there. You
can do so by using the PSFTP utility which comes with PuTTy (or any of the
many more user-friendly FTP front-ends).
Documentation
Useful documentation can be found on the SML/NJ web site. The following files will be
particularly useful:
Twelf
A reference build of the Twelf specification environment has also
been made available on the Unix clusters and is accessed similarly to SML/NJ.
The easiest way to use it is within the Emacs editor. Alternatively, you can
install a personal copy on your laptop. Downloads, documentation and examples
can be found on the Twelf wiki (it
supercedes the Twelf web page).
Trying out Twelf or any other language is likely to get you bonus points
Tasks and Percentages
- 8 homework assignments: 50%
- 4 written assignments
(# 1,
3,
5,
7)
- 4 programming assignments
(# 2,
4,
6,
8)
- Handed out on Wednesdays
- Due on Wednesday 14 (resp. 7) days later at 7:59am
Doha time (6:59am after March 11). Submit using the Blackboard dropbox.
- No joint assignments
- Midterm exam: 20%, in class on TBA,
open books
- Final exam: 30%, 3 hours, open books
Evaluation Criteria
Your assignments and exams are evaluated on the basis of:
- Correctness: your arguments should make sense, your proofs should
be valid, and your program should work in the reference
environment
- Specification: say what you want to do before doing it. In the
case of programs, use structured comments describing types, meaning of
the returned value, invariants, and side-effects
- Elegance: written material should be of the same quality as what a
professional would write. No typos, no bad grammar, clarity is paramount.
See these notes about
ML programming style
- Bonus points: up to 10% for particularly elegant
solutions
- Negative points: up to 100% if caught
cheating
Because this course is coordinated with the edition offered in
Pittsburgh, the grades of individual homeworks and exams, as well as the
final grade, will be uniformed to the performance of that class.
Late Policy
Every student has up to 3 late days that may be used for any assignment
throughout the semester, but no homework may be more than two days late (this
is so that we can discuss assignments in lecture the Wednesday after they are
due). No fractional late days: if you submit 1 minute late, you have used up
a full late day.
Academic Integrity
You are expected to comply with the University Policy
on Academic Integrity and Plagiarism.
Collaboration is regulated by the whiteboard policy: you can bounce
ideas about an assignment, but when it comes to typing it down for submission,
you are on your own - no notes, snapshots, etc., you can at most reconstruct
the reasoning from memory.
Course Objectives
This course seeks to develop students who:
- demonstrate a high level of proficiency in the fundamentals of programming
languages, namely
- are able to critically understand and analyze programming languages
and their constructs
- are able to learn and apply programming languages quickly
- are able to analyze, compare, and choose the appropriate paradigm for
a wide variety of computational tasks
- are able to approach or think about problems
mathematically, are familiar with the mathematics that relate directly
to the field of programming languages, and are able to master new
mathematical concepts that arise in the context of their work
- master fundamental, advanced, and recent concepts in the field of
programming languages
- think clearly about tangible problems and create innovative solutions
relying on proven techniques such as abstraction, decomposition,
iteration and recursion, inductive and deductive
thinking, and know the limits of computation
- communicate orally and in writing in effective and appropriate ways within
the discipline of programming languages, namely
- are able to understand and articulate technical ideas
- are able to follow and form cogent arguments
Learning Outcomes
Upon successful completion of this course, students will:
- know the basics of the theoretical foundations of programming languages
and be able to evaluate languages, easily learn additional language,
and even design new languages. Namely, students will
- be able to extrapolate the concrete syntax of a particular language
and assess constructs abstractly independently of the syntax they
are written in
- be able to discuss the semantics of a construct and describe it
semi-formally and formally
- appreciate the distinction between static and dynamic semantics
- be familiar with the standard assessment tools for programming
languages, in particular type safety theorems, and be able to
carry out a proof
- understand the main concepts in programming languages, namely:
- the difference between an interpreted and a compiled language
- the degree of abstraction at which a language sits
- the standard control flow mechanisms, including sequential execution,
branching, loops, recursion and function invocation
- types as an organizing principle and an abstraction mechanism for
data
- the most common mechanisms for code reuse including functions, modules
and libraries
- have a clear understanding of the mechanisms underlying both imperative
and non-imperative languages. Specifically, they will
- understand the standard and emerging constructs found in imperative
programming languages such as conditionals, loops, functions,
polymorphism, and exceptions
- understand the various principles underlying the object-oriented
paradigm, including encapsulated objects, classes, and
inheritance
- have familiarity with a functional language and functional programming
concepts, in particular recursion, higher-order functions,
continuations, and functional modules
- have had exposure to some of the paradigms for distributed and
concurrent programming, with emphasis on the concepts of threads
of computation, state change, synchronous and asynchronous
communication
- understand basic logic and proof techniques necessary to create and
understand a formal proof. Specifically, they will be able to
- apply formal methods of symbolic propositional and predicate logic
- describe the basic structure of and give examples of the following
proof techniques: direct proof, proof by contrapositive, proof by
contradiction, mathematical induction
- discuss which type of proof is best for a given problem
- relate the ideas of mathematical induction to recursion and
recursively defined structures
-
- identify the differences between mathematical induction and structural
induction and give examples of the appropriate use of each
- identify and correct flawed logic used in language design
- be able to communicate clearly and effectively ideas, concepts and
intentions within the field of programming languages, namely
- be able to describe technical constructs (concepts) clearly, so as to
be readily understood by their peers
- be able to give an individual presentation on a technical subject to
audience of peers within the discipline of programming languages
- form a cogent, logical argument asserting and reiterating all technical
concepts that lie within the bounds of the taught curriculum or their
research within that curriculum.