From 9911f9a73c7dc46069199e52f2bc54082d10366c Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 3 Jan 2018 23:10:59 +0100 Subject: Initial --- type.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 type.h (limited to 'type.h') 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 + + +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); -- cgit v1.2.3-54-g00ecf