summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/scope.h b/scope.h
new file mode 100644
index 0000000..196f88a
--- /dev/null
+++ b/scope.h
@@ -0,0 +1,26 @@
+#ifndef _SCOPE_H
+#define _SCOPE_H
+
+#include <llvm-c/Core.h>
+
+typedef struct scope_entry {
+ char *id;
+ LLVMValueRef value;
+ LLVMTypeRef type;
+ struct scope_entry *prev;
+} scope_entry;
+
+typedef struct scope_layer {
+ struct scope_entry *head;
+ struct scope_layer *prev;
+} scope_layer;
+
+typedef scope_layer *scope;
+
+void scope_push_layer(scope *sc);
+void scope_pop_layer(scope *sc);
+
+void scope_add_entry(scope sc, char *id, LLVMValueRef val, LLVMTypeRef type);
+scope_entry *scope_find(scope sc, char *id);
+
+#endif /* _SCOPE_H */