aboutsummaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-03-26 19:22:20 +0800
committerTeddy <ted.sybil@gmail.com>2014-03-26 19:22:20 +0800
commit5f2965bcaca608f0d9af84373565539ae384918d (patch)
treecae25013c6456dc28fc93440b2528622b730f628 /test.c
parentd2f316adaeae270e6c4e9cba040e07de3d11e737 (diff)
semantics: symbol table now works
Diffstat (limited to 'test.c')
-rw-r--r--test.c26
1 files changed, 26 insertions, 0 deletions
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 <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);
+ return 0;
+}