Previous Up Next

Chapter 4  Environments

This chapter describes the various environments used in the type checking of a Moby program. The code for these environments can be found in the mobyc/Env directory.

4.1  The environments

The Env structure collects together the various environment types. In addition, each type of environment has its own module that collects together the operations on the environment. Table 4.1 lists the environment type and their defining module.


Table 4.1: List of environments

SML type Support module Description
Env.global_env GlobalEnv Global environment
Env.top_env TopEnv Top-level environment
Env.sig_env SigEnv Signature environment
Env.ty_env TyEnv Type environment
Env.exp_env ExpEnv Expression environment

Envirnoments are layered; for example, a type environment contains a top-level environment that is used to resolve qualified names.

In the remainder of this section, we describe the rôle played by each type of environment.

4.1.1  Global environments

4.1.2  Top-level environments

4.1.3  Signature environments

4.1.4  Type environments

4.1.5  Expression environments

4.2  Compilation environments

The environment library also supports compilation environments, which provide an interface to separately compiled modules (including the pervasive definitions).
Previous Up Next