jsint
Class Environment
java.lang.Object
|
+--jsint.Environment
- public class Environment
- extends java.lang.Object
Environments store mappings from symbols to locations.
At compile time, we can lookup to see if a symbol names a location,
and at run time we can get or set the value in a location.
- Author:
- Peter Norvig, Copyright 1998, peter@norvig.com, license
subsequently modified by Jscheme project members
licensed under zlib licence (see license.txt)
|
Constructor Summary |
Environment(java.lang.Object vars,
java.lang.Object[] vals,
Environment parent)
Create an Environment with local variables and values, and a parent
Environment. |
|
Method Summary |
java.lang.Object |
get(LocalVariable var)
Get the value of the LocalVariable in this Environment. |
java.lang.Object |
lookup(Symbol var)
|
java.lang.Object |
lookup(Symbol var,
int up,
int in,
java.lang.Object vars)
Lookup the symbol in the environment. |
java.lang.Object |
set(LocalVariable var,
java.lang.Object newVal)
Set the value of the LocalVariable in this Environment to a new value. |
void |
show(java.io.PrintWriter s)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GLOBAL
public static final Environment GLOBAL
- The global environment. All info is in the Symbols themselves.
Environment
public Environment(java.lang.Object vars,
java.lang.Object[] vals,
Environment parent)
- Create an Environment with local variables and values, and a parent
Environment.
lookup
public java.lang.Object lookup(Symbol var)
lookup
public java.lang.Object lookup(Symbol var,
int up,
int in,
java.lang.Object vars)
- Lookup the symbol in the environment. Return either a
LocalVariable a Symbol representing the global variable.
get
public java.lang.Object get(LocalVariable var)
- Get the value of the LocalVariable in this Environment.
set
public java.lang.Object set(LocalVariable var,
java.lang.Object newVal)
- Set the value of the LocalVariable in this Environment to a new value.
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
show
public void show(java.io.PrintWriter s)