diff options
Diffstat (limited to 'type.h')
-rw-r--r-- | type.h | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -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); |