Language designers define type systems in order to constrain the ways
in which values may interact.
These constraints protect the underlying representation of values from
use that is contrary to the language designer's model,
allowing early detection of a number of programming errors.
The purpose of a compiler's type analysis task is to verify, insofar
as possible, that the constraints of the type system have been obeyed.
Type analysis is complex, even for simple languages, but it is based
upon a number of language-independent concepts.
The type analysis of source text in a particular language can be described
in terms of those concepts, by identifying constructs playing specific
roles in the type system of that language.
Once that identification has been made, most of the code required to carry
out the analysis can be deduced automatically.
The modules of the type analysis library define a comprehensive collection
of computational roles that can be played by symbols of an abstract syntax;
they also define computational roles that characterize specific contexts
They allow you to focus your attention on the important issues and
make strategic decisions without delving into implementation details.
This document is a reference manual for the type analysis specification
(For a tutorial on how to develop a type analyzer for a specific
Overview of Tutorial on Type Analysis.)
Examples are drawn from a variety of languages.
Our strategy is to provide only the specification fragments needed to
illustrate the relevant principles.
In most cases, these fragments will be LIDO rules.
We expect that the meaning of the abstract syntax for these rules will be
obvious, although we will sometimes show snippets of source code to make
the application clearer.