I just made a small update to the definition of Project 3 to clarify differences in the environments for dynamic and static scoping. The original description used the same environment type name,
Env, for both static and dynamic scoping. However, what’s in the environment differs between interpreters. When using dynamic scoping, the value stored with an ID in
Env is simply a
CFAE value. You just reuse the datatype from your AST definition and you’re done. When using static scoping, the value stored with an ID in
Env is a
What this means is you can’t use the same
Env type in both interpreters unless you employ some Haskell type-fu that I don’t expect you to know. Fortunately it is not a big deal to fix and if you implement your interpreters in separate files you likely did not even notice. What I did in the new project description is define the two evaluation functions to use
EnvS respectively. This eliminates the type clash between the definitions with almost no pain.
If you already have your project working, do not go back and change it to use these new type names. There is no reason to do that. If you use separate files for your implementations, you can use
Env as shown in the original project description.