Course Information
This is a course about the foundations of programming languages. A
programming language is defined by its syntax, static semantics, and
dynamic semantics. Each of these components of the language is based
on familiar mathematical and logical foundations.
- Syntax: formal languages, grammars, inductive datatypes.
- Static Semantics: type theory, abstract interpretation, data-flow
analysis, etc.
- Dynamic semantics: abstract machines, lambda-calculus,
pi-calculus, etc.
Studying the foundations of programming languages has at least the
following benefits:
- Despite their apparent diversity, programming languages
(including not just general purpose programming languages, but also
domain-specific languages, scripting languages, and other little
languages) have a lot more in common than may first
seem. Understanding the foundations allows a programmer to
seamlessly learn and work with a variety of languages.
- Mapping the features of a given programming language to their
mathematical and logical foundations gives a programmer a detailed
and rigorous understanding of all the subtleties of the language.
- To make any interesting guarantees about the behavior of programs
written in a particular programming language, one must define a
mathematical model for the language and formally prove some
properties about it.
We will study everything in the context of Java. The mathematical
foundations of Java are not that different from those of other modern
languages, but Java is interesting for three reasons. First it is
widely accessible and popular. Second it has several subtle points
that programmers can easily misunderstand or overlook. And third it
became popular by making claims about the safety of applets. Because
software practice is moving away from monolothic applications to
dynamically-loaded distributed components, this safety claim was
particularly interesting. For our purposes, it is even more
interesting that the initial claim that Java applets are safe is
wrong and the entire class-loading architecture had to be redesigned
from scratch!
In summary, the Java language, with its important safety properties,
provides a good context for the study of the foundations of
programming languages.
In more detail, the course will proceed as follows:
- Develop a formal mathematical model that describes the static and
dynamic semantics of Java.
- Use the model to prove type safety which is one the fundamental
component of any security guarantee.
- Because Java is a large language, both the semantics and the proof
are large, and we need some automated support. We will use AsmGofer
(which is a formalism for specifying abstract state machines built
on an old implementation of Haskell).
- We will then repeat the previous development with the JVM.
This development closely follows the Jbook but skips most of Part II
which is related to the compiler and its correctness. This material is
also interesting but I don't think we have time to cover it. See the
schedule for more details.