public class Environment
extends java.lang.Object
D(la.la.Declaration)
and Declaration
.Modifier and Type | Field and Description |
---|---|
static Environment |
empty
A (the) empty Environment -- might be useful for
Functions that are complete unto themselves? |
static Environment |
initial
The initial Environment (standard
Library ). |
protected Environment |
next
next links 'this' to the previous- (sub-) Environment, if any.
|
Modifier | Constructor and Description |
---|---|
protected |
Environment()
Create an empty Environment (with no sub-Environment).
|
protected |
Environment(Environment next)
Create an empty Environment linked to next.
|
Modifier and Type | Method and Description |
---|---|
Environment |
bind(java.lang.String[] ids,
Value[] vs)
Extend 'this' Environment by binding Variables 'ids' to Values 'vs'.
|
Environment |
bind(java.lang.String id,
Value v)
Extend 'this' Environment by binding a Variable 'id' to
a Value 'v'; typically id is the formal
parameter of a Function. |
Environment |
D(Declaration dec)
Extend 'this' Environment as specified by Declaration(s) 'dec',
semantically
|
Value |
lookup(Expression.Ident EId)
Return the Value bound to Variable 'EId'.
|
protected Value |
lookup(Expression.Ident EId,
int levels)
Note, nothing is declared
initially . |
java.lang.String |
toString()
For debugging.
|
protected Value |
val(int offset)
Return the Value bound to the 'offset'th Variable.
|
Value |
val(int levels,
int offset)
Descend 'levels' of sub-Environments, and there return
the Value bound to the 'offset'th Variable.
|
protected final Environment next
public static final Environment empty
Functions
that are complete unto themselves?public static final Environment initial
Library
).protected Environment()
protected Environment(Environment next)
public Value val(int levels, int offset)
protected Value val(int offset)
public Value lookup(Expression.Ident EId)
protected Value lookup(Expression.Ident EId, int levels)
initially
.public Environment bind(java.lang.String id, Value v)
parameter
of a Function.public Environment bind(java.lang.String[] ids, Value[] vs)
public Environment D(Declaration dec)
public java.lang.String toString()
toString
in class java.lang.Object