Course outline (Programming Languages)

From Spivey's Corner

Jump to: navigation, search

Aim of the course: to investigate the semantics of programming languages by writing interpreters in Haskell that work on abstract syntax trees.

This page gives an outline of the course, supplemented by several kinds of document:

The Windows sources (in ZIP archives) are identical in all respects to the Unix sources (in Gzipped tar files), except that the common module Parsing.hs has been adjusted to work with Windows GHC.

Contents

The functional language Fun

[1] Introducing Fun, with familiar examples rewritten in the language.

[2] The concrete and abstract syntax of Fun.

[3] A recursive interpreter for Fun. Examples of evaluation.

[4] Defunctionalization: a first-order interpreter for a higher-order language.

Adding memory, introducing monads

[5] Changing the interpreter to support assignable variables, with references as expressible values (like ML).

[6] Implementing while by recursion. Styles of semantics

[7] Changing the interpreter to support output; extracting common features of memory and output.

[8] Interpreters in monadic form.

Semantic variations

[9] Review: a language with exceptions.

[10] The language Fungol, where identifiers are bound to assignable variables, and derefencing is implicit.

[11] Call by value and call by reference.

Continuations

[12] Introducing continuations

[13] Interpreters in continuation-passing style

[14] Continuations for exceptions and I/O

[15] First-class continuations

[16] Continuations and abstract machines

Bonus tracks

Appendices

These appendices contain supporting code: the library Parsing that contains tools for building interactive parsers; the definitive abstract syntax (FunSyntax) and parser (FunParser) for the Fun language with all the extensions included; and implementations of Environment and Memory. Tangled copies of this code appear packaged with the interpreters throughout the course, but here it is gathered together in all its gory detail.

Some of the code provided here is boring and routine, and some is just a compilation of fragments of syntax needed at different times during the course. But actually, the Parsing library is quite interesting because it uses continuations to allow parsers to suspend themselves and request more input interactively.

Navigation
Toolbox