mhogenso/Zuse — pull request #9 by pwightman (2013-11-13 20:24:37+00:00)
Title: Added the scope statement to the interpreter which captures variables properly

@mhogenso and @finalfantasyfreak15 These are the changes made to the interpreter to support scoping, which will allow us to support traits, which I've talked to you both about but separately. Note that the "scope" statement is *not* part of the intermediate language necessarily, it's an implementation detail of the interpreter. Converting traits into scopes will be the job of the compiler.

Following are notable changes:

- Changed some keys in the HIR (high-level intermediate representation), like args/variables -> parameters, name -> method, etc.
- Each interpreter method now passes an 'environment' along which is a dictionary of variables that are "in scope." We didn't have to do this previously because we assumed everything happened in the object scope, but since we've decided that properties created in trait code should not infect the object scope, this is required.
- Events called within a scope need to have that same scope around when it runs later, so the code and the environment are now saved off instead of just the code.
- Test cases were added for scoping and scoping with events