public final class Environment
extends java.lang.Object
Constructor and Description |
---|
Environment()
create empty type and value environment
|
Modifier and Type | Method and Description |
---|---|
void |
addTCC(Expression formula)
Add type checking condition to environment.
|
Environment |
cloneGlobal()
Create clone of global part of environment; the clone is a shallow
copy (the symbols in the environment are not cloned).
|
void |
enter()
enter a new scope
all changes done to the environment after enter() will be undone
after exit()
|
void |
exit()
exit a scope
all changes done after the after the last enter() are undone
|
FormulaSymbol |
getFormulaSymbol(Identifier name)
returns symbol associated to name (null, if none)
|
java.util.Collection<Symbol> |
getFormulaSymbols()
Get all formula symbols.
|
java.util.Vector<ValueSymbol> |
getGlobalValueSymbols()
Get global value symbols in the order in which they were entered.
|
java.util.Vector<Symbol> |
getLocalVariables()
get local variables (all values with environment depth gt 0)
|
Expression[] |
getTCCs()
Get type checking conditions of current scope (not of all scopes).
|
Type |
getType(Identifier name)
returns canonical type associated to key
type equality implies pointer equality of types.
|
TypeSymbol |
getTypeSymbol(Identifier name)
returns type symbol associated to key
|
java.util.Collection<Symbol> |
getTypeSymbols()
Get all type symbols.
|
ValueSymbol |
getValueSymbol(Identifier name)
returns symbol associated to name (null, if none)
|
java.util.Collection<Symbol> |
getValueSymbols()
Get all value symbols.
|
void |
put(ValueDeclIdentifier ident)
add the symbol associated to ident to current environment
|
FormulaSymbol |
putFormula(FormulaDeclIdentifier name,
Expression formula,
boolean axiom)
put formula in environment
|
FormulaSymbol |
putFormulaDeclaration(FormulaDeclaration fdecl)
put formula declaration into environment
|
void |
putFormulaSymbol(FormulaSymbol symbol)
add formula symbol to environment
|
TypeSymbol |
putType(TypeDeclIdentifier name,
Type type)
put type in type table
|
TypeSymbol |
putTypeDeclaration(TypeDeclaration tdecl)
put type declaration into environment
|
ValueSymbol |
putValue(ValueDeclIdentifier name,
Type type,
Expression value)
put named value in value table
|
ValueSymbol |
putValueDeclaration(ValueDeclaration vdecl)
put value declaration into environment
|
boolean |
putVariables(TypedIdentifier[] vars)
put variables into environment
|
public Environment cloneGlobal()
public void enter()
public void exit()
public TypeSymbol putType(TypeDeclIdentifier name, Type type)
name
- the name of the typetype
- the type associated to the namepublic TypeSymbol getTypeSymbol(Identifier name)
name
- the name of the typepublic Type getType(Identifier name)
name
- the name of the typepublic ValueSymbol putValue(ValueDeclIdentifier name, Type type, Expression value)
name
- the name of the valuetype
- the type associated to the valuevalue
- the value itself (may be null)public ValueSymbol getValueSymbol(Identifier name)
name
- the namepublic TypeSymbol putTypeDeclaration(TypeDeclaration tdecl)
tdecl
- type declarationpublic ValueSymbol putValueDeclaration(ValueDeclaration vdecl)
vdecl
- value declarationpublic boolean putVariables(TypedIdentifier[] vars)
vars
- the variable sequencepublic java.util.Vector<Symbol> getLocalVariables()
public FormulaSymbol putFormula(FormulaDeclIdentifier name, Expression formula, boolean axiom)
name
- the name of the formulaformula
- the expression associated to the formulaaxiom
- true iff formula is axiompublic FormulaSymbol getFormulaSymbol(Identifier name)
name
- the namepublic void putFormulaSymbol(FormulaSymbol symbol)
symbol
- symbol to be added (name must not clash with other
symbol in formula table)public FormulaSymbol putFormulaDeclaration(FormulaDeclaration fdecl)
fdecl
- formula declarationpublic void put(ValueDeclIdentifier ident)
ident
- identifier for an already processed value declarationpublic java.util.Collection<Symbol> getTypeSymbols()
public java.util.Collection<Symbol> getValueSymbols()
public java.util.Vector<ValueSymbol> getGlobalValueSymbols()
public java.util.Collection<Symbol> getFormulaSymbols()
public void addTCC(Expression formula)
formula
- the condition.public Expression[] getTCCs()