diff options
| author | Carson Fleming <cflems@cflems.net> | 2026-07-26 19:20:30 -0700 |
|---|---|---|
| committer | Carson Fleming <cflems@cflems.net> | 2026-07-26 19:20:30 -0700 |
| commit | 4f9d0247549b06ddb25b76bb425541190105cb48 (patch) | |
| tree | 56f191c3611fc7509e6350138ce03c20956b656f /type.h | |
| parent | 6a169de321b131e73b86967a1a8564365217275a (diff) | |
| download | ccc-4f9d0247549b06ddb25b76bb425541190105cb48.tar.gz | |
functioning type system perhaps?
Diffstat (limited to 'type.h')
| -rw-r--r-- | type.h | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -0,0 +1,43 @@ +#ifndef TYPE_H +#define TYPE_H + +#include "ccc.h" + +struct data_type { + const char* name; + integral_t sz; + bool is_floating; +}; + +struct type { + enum { + TP_DATA, + TP_PTR, + } type; + union { + struct { + const struct data_type* data_type; + bool is_signed; + } data; + struct { + const struct data_type* data_type; + integral_t ptr_level; + } pointer; + }; +}; + +extern const struct data_type void_type; +extern const struct data_type char_type; +extern const struct data_type short_type; +extern const struct data_type int_type; +extern const struct data_type long_type; +extern const struct data_type long_long_type; +extern const struct data_type float_type; +extern const struct data_type double_type; + +extern const struct data_type* integral_type; +extern const struct data_type* floating_type; +extern const struct data_type* character_type; +extern const struct data_type* primitive_types[]; + +#endif |
