diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-01-03 23:10:59 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-01-03 23:10:59 +0100 |
commit | 9911f9a73c7dc46069199e52f2bc54082d10366c (patch) | |
tree | 914cd4fc2367207271c1c53c7f11a96ed9bbc9b7 /type.h |
Initial
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); |