45 return tree(BARRIER, lenv);
112 while (!
isNil(ldefs)) {
117 stringstream s; s <<
boxpp(
id);
151 for (
unsigned int i=0; i < clos.size(); i++) {
152 Tree exp, genv, visited, lenv;
153 if (
isClosure(clos[i], exp, genv, visited, lenv)) {
154 if (lenv == oldEnv) {
155 clos[i] =
closure(exp, genv, visited, newEnv);
171 vector<Tree> ids, clos;
178 for (
unsigned int i=0; i < clos.size(); i++) {
182 while (!
isNil(ldefs)) {
187 stringstream s; s <<
boxpp(
id);
Symbol * unique(const char *str)
Returns a new unique symbol of name strxxx.
Class Node = (type x (int + double + Sym + void*))
static void updateClosures(vector< Tree > &clos, Tree oldEnv, Tree newEnv)
Replace closure that point to oldEnv with closure on newEnv.
Tree pushValueDef(Tree id, Tree def, Tree lenv)
Push a new layer and add a single definition.
Tree copyEnvReplaceDefs(Tree anEnv, Tree ldefs, Tree visited, Tree curEnv)
Create a new environment by copying an existing one and replacing some definitions.
bool isEnvBarrier(Tree lenv)
Test if the environment is a barrier (or nil) so that searchIdDef will know where to stop when search...
static void addLayerDef(Tree id, Tree def, Tree lenv)
Add a definition (as a property) to the current top level layer.
bool searchIdDef(Tree id, Tree &def, Tree lenv)
Search the environment (until first barrier) for the definition of a symbol ID and return it...
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const Node & node() const
return the content of the tree
void setDefNameProperty(Tree t, Tree id)
void evalwarning(const char *filename, int linenum, const char *msg, Tree exp)
Tree pushEnvBarrier(Tree lenv)
static Tree pushNewLayer(Tree lenv)
Push a new (unique) empty layer (where multiple definitions can be stored) on top of an existing envi...
Tree pushMultiClosureDefs(Tree ldefs, Tree visited, Tree lenv)
Push a new layer with multiple definitions creating the appropriate closures.
int getDefLineProp(Tree sym)
bool isClosure(Tree t, Tree &abstr, Tree &genv, Tree &vis, Tree &lenv)
Sym BARRIER
Push a new environment barrier on top of an existing environment so that searchIdDef (used by the pat...
Tree closure(Tree abstr, Tree genv, Tree vis, Tree lenv)
Symbols are unique objects with a name stored in a hash table.
void setProperty(Tree t, Tree key, Tree val)
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
Interface for names management.
void exportProperties(vector< Tree > &keys, vector< Tree > &values)
export the properties of a CTree as two vectors, one for the keys and one for the associated values ...
Tree branch(int i) const
return the ith branch (subtree) of a tree
const char * getDefFileProp(Tree sym)
bool getProperty(Tree t, Tree key, Tree &val)
void print(Tree t, FILE *out)