From 5f2965bcaca608f0d9af84373565539ae384918d Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 26 Mar 2014 19:22:20 +0800 Subject: semantics: symbol table now works --- test.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test.c (limited to 'test.c') diff --git a/test.c b/test.c new file mode 100644 index 0000000..20b2968 --- /dev/null +++ b/test.c @@ -0,0 +1,26 @@ +#include +#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); + return 0; +} -- cgit v1.2.3-70-g09d2