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 /scope.h | |
| parent | 6a169de321b131e73b86967a1a8564365217275a (diff) | |
| download | ccc-4f9d0247549b06ddb25b76bb425541190105cb48.tar.gz | |
functioning type system perhaps?
Diffstat (limited to 'scope.h')
| -rw-r--r-- | scope.h | 37 |
1 files changed, 10 insertions, 27 deletions
@@ -2,6 +2,7 @@ #define SCOPE_H #include "ccc.h" +#include "type.h" struct storage_location { enum { @@ -23,34 +24,19 @@ struct storage_location { }; }; -struct type_ref { - const struct type_def* raw_type; - unsigned char ptr_level; -}; - -struct type_key { - char* name; - unsigned char how_long; - bool marked_unsigned; - bool marked_signed; -}; - -struct type_def { - struct type_key key; - bool is_signed; - bool is_floating; - integral_t sz; +struct type_alias { + const char* name; + struct type type; }; struct var_def { - const struct type_ref* type; + const struct type* type; char* name; struct storage_location loc; - const struct type_def* resolved_type; }; struct scope { - struct type_def** types; + struct type_alias** types; integral_t type_sz; integral_t type_cap; @@ -62,19 +48,16 @@ struct scope { integral_t bp_offset; }; -struct ast; - void scope_push(struct scope** p_scope); void scope_pop(struct scope** p_scope); void scope_destroy(struct scope* scope); -void scope_install_default_types(struct ast* ast); bool scope_get_type( const struct scope* scope, - const struct type_def** p_entry, - const struct type_key* key); -const struct type_def* scope_define_type( + const struct type_alias** p_entry, + const char* name); +const struct type_alias* scope_define_type( struct scope* scope, - struct type_def type); + struct type_alias type); bool scope_get_var( const struct scope* scope, struct var_def** p_entry, |
