#ifndef VARS_H #define VARS_H struct storage_location { enum { REGISTER, JMP_LABEL, BP_OFFSET, } type; union { long long offset; const char* label; }; }; struct type_def { const char* name; unsigned long long size; }; struct var_def { const char* name; struct storage_location loc; }; struct scope { struct type_def** types; unsigned long long type_sz; unsigned long long type_cap; struct var_def** vars; unsigned long long var_sz; unsigned long long var_cap; struct scope* next_out; unsigned long long bp_offset; }; void scope_push(struct scope** p_scope); void scope_pop(struct scope** p_scope); void scope_install_default_types(struct scope* scope); bool scope_get_type( const struct scope* scope, struct type_def* p_entry, const char* name); void scope_define_type(struct scope* scope, struct type_def type); bool scope_get_var( const struct scope* scope, struct var_def* p_entry, const char* name); void scope_define_var(struct scope* scope, struct var_def var); #endif