Type Analysis
The modules of the type analysis library define a comprehensive collection
of computational roles that can be played by the symbols and rules of a
LIDO grammar.
This document is a reference manual for these roles; for a tutorial, see
Top of Tutorial on Type Analysis.
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
within expressions.
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
modules.
(For a tutorial on how to develop a type analyzer for a specific
language, see
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.
|