Evaluation environment

I am currently working on the evaluation environment for the owlisp compiler. It is essential for a compiler/interpreter (at least when targeting languages that support mutable state) to support this feature in order to keep track of variable bindings that are in effect at one point or another.

As it turns out, especially two books seem to be of great value regarding this domain:

I think getting this environment issue right is the key to developing a compiler and/or interpreter. The process of adding language features will also  That is why I am thinking a lot about how to design a data structure in my owlisp compiler that can represent such an environment in an intelligent and flexible way.

There are several requirements:


That data structure should support several types of scoping, namely:

  • dynamic scoping
  • global scoping
  • lexical scoping

whereby a global scope just seems to be a special case of a dynamic scope with indefinite extent. I am not yet sure if I will be able to merge them both to be just one “entity” in the final data structure.


Another requirement is that the environment data structure needs to support different namespaces for variables vs. functions, i.e. support Lisp-2.


I think the package concept of Common Lisp (defpackage etc.) will also have an impact on the environment implementation, since the bindings will differ, depending on which package you are currently in. So I will take this into consideration as well.

In order to keep this simple initially, I am playing around with this by implementing an interpreter before messing with the compiler stuff 😉 . You can check this out in the branch called “interpreter” in the owlisp github repo. Needless to say, the implementation far from complete or correct at the moment 😉 .