blob: 21314b1f94c884e30a09d06d355289b2f9b3e716 (
plain) (
tree)
|
|
#include <stdlib.h>
#include "semantics.h"
#define PV(str) cscope_push_var(scope, newvar(str))
CVar_t newvar(const char *name) {
return cvar_create(name, NULL);
}
CType_t newtype(const char *name) {
return ctype_create(name, 0);
}
int main() {
CScope_t scope = cscope_create();
PV("a");
PV("b");
PV("asdf");
PV("fdsa");
PV("hello");
cscope_debug_print(scope);
cscope_enter(scope);
PV("a");
PV("hello");
cscope_debug_print(scope);
cscope_enter(scope);
PV("a");
PV("yay");
PV("world");
cscope_debug_print(scope);
cscope_exit(scope);
cscope_debug_print(scope);
cscope_exit(scope);
cscope_debug_print(scope);
return 0;
}
|