scopes.c
// Initialize a local scope and set cur_scope as the parent
Initialize a local scope and set cur_scope as the parent
Initialize a local scope and set cur_scope as the parent
void enter_scope(void) {
    Scope *scope = malloc(sizeof(Scope));
    memset(scope, 0, sizeof(Scope));
    scope->symbol_list = malloc(sizeof(Symbol) * MAX_LOCAL_SCOPE_IDENTIFIERS);
    scope->symbols = new_strmap();
    scope->tags = new_strmap();
    scope->max_count = MAX_LOCAL_SCOPE_IDENTIFIERS;
    scope->symbol_count = 0;
    scope->parent = cur_scope;
    cur_scope = scope;
}
void enter_scope ( void ) { Scope * scope = malloc ( sizeof ( Scope ) ) ; memset ( scope , 0 , sizeof ( Scope ) ) ; scope -> symbol_list = malloc ( sizeof ( Symbol ) * MAX_LOCAL_SCOPE_IDENTIFIERS ) ; scope -> symbols = new_strmap ( ) ; scope -> tags = new_strmap ( ) ; scope -> max_count = MAX_LOCAL_SCOPE_IDENTIFIERS ; scope -> symbol_count = 0 ; scope -> parent = cur_scope ; cur_scope = scope ; }
Initialize a local scope and set cur_scope as the parent
Initialize a local scope and set cur_scope as the parent