#include #include #include #include #include #include #include #include #include "variable/new.h" #include "variable/compare.h" #include "variable/free.h" #include "struct.h" #include "new.h" struct scope* new_scope() { ENTER; struct scope* this = smalloc(sizeof(*this)); this->tree = avl_alloc_tree( /* comparator: */ compare_variables, /* free-er: */ free_variable); // add W: { struct string* w = new_string("w"); void* ptr = avl_insert(this->tree, new_variable(w, W)); assert(ptr); free_string(w); } // add X: { struct string* x = new_string("x"); void* ptr = avl_insert(this->tree, new_variable(x, X)); assert(ptr); free_string(x); } // add Y: { struct string* y = new_string("y"); void* ptr = avl_insert(this->tree, new_variable(y, Y)); assert(ptr); free_string(y); } // add Z: { struct string* z = new_string("z"); void* ptr = avl_insert(this->tree, new_variable(z, Z)); assert(ptr); free_string(z); } EXIT; return this; }