An environment maps identifiers in the input to information about their intended behavior in the program. For instance, some identifiers act as keywords that represent a micro or a macro, others are bound by a binding construct, and others are unbound.
McMicMac uses the type env-entry to range over representations of the possible types of behaviors an identifier can exhibit. env-entry includes:
macro-resolution (rewriter)
micro-resolution (rewriter)
top-level-resolution ()
The rewriter fields contain a micro or macro, as appropriate. Micros have the type read env attr vocab parsed while macros have the type read env read.
Languages implemented atop McMicMac will extend env-entry to reflect their binding constructs. Unless extended, all identifiers that do not resolve to macro or micros will yield top-level-resolutions.
extend-env
list (new-vars+marks) env
retract-env
list (new-vars) env
resolve
id env vocab env-entry
These procedures will be elaborated on later.