#include #include "scope.h" #include "hashtable.h" scope_t* init_scope(scope_t parent) { scope_t* scope = malloc(sizeof(scope_t)); scope->hashtable = init_hashtable(1000); *(scope->parent) = parent; return scope; } pair_t* get_pair_global(scope_t* scope, char* key) { while (scope->parent != NULL) { pair_t* pair = hashtable_get_pair(scope->hashtable, key); if (pair != NULL) { return pair; } scope = scope->parent; } return NULL; }