From 3445947c072a4cd533f5f3a53178f77361859123 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Wed, 29 Jul 2026 23:58:55 -0400 Subject: improve type system --- type.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'type.c') diff --git a/type.c b/type.c index c5f6e65..4bff103 100644 --- a/type.c +++ b/type.c @@ -42,11 +42,29 @@ const struct data_type double_type = { .is_floating = true, }; -const struct data_type* integral_type = &long_type; -const struct data_type* floating_type = &double_type; -const struct data_type* character_type = &char_type; const struct data_type* primitive_types[] = { &void_type, &char_type, &short_type, &int_type, &long_type, &long_long_type, &float_type, &double_type, NULL }; + +const struct type integral_type = { + .type = TP_DATA, + .data.data_type = &long_type, + .data.is_signed = true, +}; +const struct type floating_type = { + .type = TP_DATA, + .data.data_type = &double_type, + .data.is_signed = true, +}; +const struct type character_type = { + .type = TP_DATA, + .data.data_type = &char_type, + .data.is_signed = true, /* impl defined */ +}; +const struct type string_type = { + .type = TP_PTR, + .pointer.data_type = &char_type, + .pointer.ptr_level = 1, +}; -- cgit v1.2.3