An environment is a stack of scopes with the innermost scope on the top.
Support for unique ids for named things.
A named entity.
A scope maps identifiers to entities.
Define i to be e in the current scope of env, raising an error if the environment is empty.
Enter a new empty scope nested within the given environment.
Say whether i is defined in any scope of env.
Say whether i is defined in an innermost scope of env (i.e., in the current scope).
Say whether i is defined in an outer scope of env (i.e., not in the current scope).
Say whether i is defined in the given scope.
Say whether i is defined in the current scope of env.
Leave the outermost scope of the given environment, raising an error if the environment is empty.
Look up i in env, returning the mapped Entity if there is one, otherwise return e.
Look up i in env, returning the mapped Entity if there is one, otherwise return e. If scope is true, just search the innermost scope, otherwise search outwards in all scopes, returning the first Entity found, if any.
A counter to count generated names.
Reset the environment module.
Create a root environment, i.e., one that has a single scope containing the given bindings.
General implementation of environments as stacked scopes. The objects associated with names in environments are of type Entity.