aboutsummaryrefslogtreecommitdiff
path: root/type.h
diff options
context:
space:
mode:
Diffstat (limited to 'type.h')
-rw-r--r--type.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/type.h b/type.h
new file mode 100644
index 0000000..6e6e0f6
--- /dev/null
+++ b/type.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <stdio.h>
+
+
+enum type_tag {
+ T_INT,
+ T_VOID,
+ T_PTR
+};
+
+struct type {
+ enum type_tag tag;
+ union {
+ struct { // T_INT
+ int size;
+ };
+ struct {}; // T_VOID
+ struct { // T_PTR
+ struct type *target;
+ };
+ };
+};
+
+
+void type_cache_cleanup(void);
+
+struct type* type_int(int size);
+struct type* type_void(void);
+struct type* type_ptr(struct type *type);
+
+void type_print(struct type *type, FILE *f);