ix.util.lisp
Class Interpreter.LexicalEnv

java.lang.Object
  extended by ix.util.lisp.Interpreter.AbstractEnv
      extended by ix.util.lisp.Interpreter.LexicalEnv
All Implemented Interfaces:
Interpreter.Env
Enclosing class:
Interpreter

public class Interpreter.LexicalEnv
extends Interpreter.AbstractEnv

An environment for local values of variables.


Field Summary
(package private)  Interpreter.LexicalEnv enclosingEnv
           
(package private)  java.lang.Object[] vals
           
(package private)  Symbol[] vars
           
 
Constructor Summary
Interpreter.LexicalEnv(Symbol[] vars, java.lang.Object[] vals, Interpreter.LexicalEnv next)
           
 
Method Summary
 java.lang.Object assign(Interpreter.VarRef ref, java.lang.Object val)
          Changes the value bound to the variable and then returns the new value.
 Interpreter.Env bind(Symbol[] vars, java.lang.Object[] vals)
          Returns a new Env in which the variables are bound to the corresponding values.
protected  int findIndex(Symbol var)
           
protected  void findOffsets(Interpreter.VarRef ref)
           
 java.lang.Object lookup(Interpreter.VarRef ref)
          Returns the value bound to the variable by this environment.
 
Methods inherited from class ix.util.lisp.Interpreter.AbstractEnv
defaultValue, isTrue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vars

Symbol[] vars

vals

java.lang.Object[] vals

enclosingEnv

Interpreter.LexicalEnv enclosingEnv
Constructor Detail

Interpreter.LexicalEnv

public Interpreter.LexicalEnv(Symbol[] vars,
                              java.lang.Object[] vals,
                              Interpreter.LexicalEnv next)
Method Detail

lookup

public java.lang.Object lookup(Interpreter.VarRef ref)
Description copied from interface: Interpreter.Env
Returns the value bound to the variable by this environment.


bind

public Interpreter.Env bind(Symbol[] vars,
                            java.lang.Object[] vals)
Description copied from interface: Interpreter.Env
Returns a new Env in which the variables are bound to the corresponding values.


assign

public java.lang.Object assign(Interpreter.VarRef ref,
                               java.lang.Object val)
Description copied from interface: Interpreter.Env
Changes the value bound to the variable and then returns the new value. Note that this typically modifies an existing binding relationship rather than create a new one; however, a new one may be created, for instance if the variable is not already bound.


findOffsets

protected void findOffsets(Interpreter.VarRef ref)

findIndex

protected int findIndex(Symbol var)