Remove int uint, all programs compiling

This commit is contained in:
Krzosa Karol
2022-06-06 09:36:37 +02:00
parent 325050300a
commit 960523b443
12 changed files with 83 additions and 94 deletions

View File

@@ -64,6 +64,18 @@ gen_simple_decl(Ast_Resolved_Type *ast, Intern_String name){
} }
} }
function void
gen_value(Value a){
gen("%s", docname(a.type));
switch(a.type->kind){
CASE_INT: gen("%lld", bigint_as_signed(&a.big_int_val)); break;
CASE_STRING: gen("LIT(\"%s\")", a.intern_val.str); break;
CASE_BOOL: a.bool_val ? gen("true"):gen("false"); break;
CASE_FLOAT: gen("%f", a.f64_val); break;
invalid_default_case;
}
}
function void function void
gen_expr(Ast_Expr *ast){ gen_expr(Ast_Expr *ast){
switch(ast->kind){ switch(ast->kind){
@@ -73,11 +85,7 @@ gen_expr(Ast_Expr *ast){
} }
CASE(VALUE, Atom){ CASE(VALUE, Atom){
if(is_int(node->type)) gen("%lld", bigint_as_signed(&node->big_int_val)); gen_value(node->value);
else if(is_string(node->type)) gen("LIT(\"%s\")", node->intern_val.str);
else if(is_bool(node->type)) node->bool_val ? gen("true"):gen("false");
else if(is_float(node->type)) gen("%f", node->f64_val);
else invalid_codepath;
BREAK(); BREAK();
} }
@@ -311,16 +319,20 @@ gen_ast(Ast *ast){
} }
} }
else if(sym->type == untyped_float){ else if(sym->type == untyped_float){
gen("// constant F64 %s = %f;", node->name.str, sym->f64_val); gen("// F64 %s = ", node->name.str);
gen_value(sym->value);
} }
else if(sym->type == untyped_int){ else if(sym->type == untyped_int){
gen("// constant int %s = %lld;", node->name.str, bigint_as_signed(&sym->big_int_val)); gen("// constant int %s = ", node->name.str);
gen_value(sym->value);
} }
else if(sym->type == untyped_string){ else if(sym->type == untyped_string){
gen("// const String %s = LIT(\"%s\");", node->name.str, sym->intern_val.str); gen("// const String %s = ", node->name.str);
gen_value(sym->value);
} }
else if(sym->type == untyped_bool){ else if(sym->type == untyped_bool){
gen("// const Bool %s = %d;", node->name.str, sym->bool_val); gen("// const Bool %s = ", node->name.str);
gen_value(sym->value);
} }
else if(sym->type == type_type){ else if(sym->type == type_type){
if(sym->type_val->kind == TYPE_STRUCT){ if(sym->type_val->kind == TYPE_STRUCT){

View File

@@ -1,6 +1,6 @@
Thing :: struct Thing :: struct
len: int len: S64
Constant_String :: "Test" Constant_String :: "Test"
Constant :: 10 Constant :: 10

View File

@@ -1,44 +1,44 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Function types // Function types
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
test_function :: (thing: int): *int test_function :: (thing: S64): *S64
function_type: test_function function_type: test_function
const_function_alias :: test_function const_function_alias :: test_function
// null_function: (t: int): *int = null // null_function: (t: S64): *S64 = null
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Booleans // Booleans
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Boolean: Bool = true Boolean: Bool = true
value_of_Bool: int = cast(Boolean: int) value_of_Bool: S64 = cast(Boolean: S64)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Nulls // Nulls
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// int_null: int = null // int_null: S64 = null
// str_null: String = null // str_null: String = null
// Bool_null: Bool = null // Bool_null: Bool = null
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Compound expressions // Compound expressions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
array1: [4]int = [4]int(1,2,3,4) array1: [4]S64 = [4]S64(1,2,3,4)
array2 := [32]int(1,2,3,4) array2 := [32]S64(1,2,3,4)
array3 := [32]int( array3 := [32]S64(
[0] = 0, [0] = 0,
[1] = 1, [1] = 1,
[2] = 2, [2] = 2,
[31] = 31, [31] = 31,
) )
array_item := array1[0] array_item := array1[0]
array_item_imp: int = array2[2] array_item_imp: S64 = array2[2]
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Pointers // Pointers
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
pointer_decl : *int pointer_decl : *S64
variable_from_deref: int = *pointer_decl variable_from_deref: S64 = *pointer_decl
pointer_from_var : *int = &variable_from_deref pointer_from_var : *S64 = &variable_from_deref
Boolean_pointer := &Boolean Boolean_pointer := &Boolean
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -50,9 +50,9 @@ implicit_str :: "Hello world"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Pointers // Pointers
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// pointer1: *int = 0 // pointer1: *S64 = 0
// pointer2: *int = pointer1 // pointer2: *S64 = pointer1
// pointer3: **int = 0 // pointer3: **S64 = 0
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// String types // String types
@@ -61,7 +61,7 @@ string1 :: "Test"
string2 :: string1 string2 :: string1
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Constant int variables // Constant S64 variables
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
thing0 :: 10 thing0 :: 10
thing1 :: thing0 + 11 thing1 :: thing0 + 11

View File

@@ -1,8 +1,8 @@
a_type :: int a_type :: S64
pointer_type :: *int pointer_type :: *S64
// null_pointer: pointer_type = null // null_pointer: pointer_type = null
if_stmt :: (cond: int): type if_stmt :: (cond: S64): type
CONSTANT :: 10 CONSTANT :: 10
thing := 10 thing := 10
if i := thing + cond, cond + CONSTANT if i := thing + cond, cond + CONSTANT
@@ -17,11 +17,11 @@ for_stmt :: ()
for i := 0, i + 10, i+=1 for i := 0, i + 10, i+=1
pass pass
add_10 :: (size: int): int add_10 :: (size: S64): S64
add_20 :: (new_size: int): int add_20 :: (new_size: S64): S64
return 20 return 20
add :: (a: int, b: int = 10): int add :: (a: S64, b: S64 = 10): S64
return a + b return a + b
constant :: 20; result := constant + 10 constant :: 20; result := constant + 10
@@ -38,13 +38,13 @@ add_10 :: (size: int): int
return v4 return v4
return_constant :: (): int return_constant :: (): S64
constant :: 10 constant :: 10
return constant return constant
returning_void :: (insert: int) returning_void :: (insert: S64)
val1: int = return_constant() val1: S64 = return_constant()
val2: int = add_10(val1) val2: S64 = add_10(val1)
return return

View File

@@ -120,6 +120,7 @@ int main(){
String result = {}; String result = {};
#if 0 #if 0
#endif
result = compile_file("globals.kl"_s); result = compile_file("globals.kl"_s);
printf("%s", result.str); printf("%s", result.str);
result = compile_file("enums.kl"_s); result = compile_file("enums.kl"_s);
@@ -130,7 +131,6 @@ int main(){
printf("%s", result.str); printf("%s", result.str);
result = compile_file("lambdas.kl"_s); result = compile_file("lambdas.kl"_s);
printf("%s", result.str); printf("%s", result.str);
#endif
result = compile_file("new_types.kl"_s); result = compile_file("new_types.kl"_s);
printf("%s", result.str); printf("%s", result.str);

View File

@@ -5,7 +5,7 @@ unary_test :: ()
float_val :: 124.42 float_val :: 124.42
conversion: F64 = -+int_val conversion: F64 = -+int_val
float2 := -float_val float2 := -float_val
unsigned: int = -+-+-int_val unsigned: S64 = -+-+-int_val
not: Bool = !int_val not: Bool = !int_val
notf := !float_val notf := !float_val

View File

@@ -2,7 +2,7 @@
other_func :: () other_func :: ()
a_val := recursive_lambda a_val := recursive_lambda
recursive_lambda :: (thing: int) recursive_lambda :: (thing: S64)
in_val := recursive_lambda in_val := recursive_lambda
some_value := thing + const_in_lambda some_value := thing + const_in_lambda

View File

@@ -11,20 +11,20 @@ arena := Arena(
cap = 1000, cap = 1000,
) )
// lambda_value := (val: int) // @todo // lambda_value := (val: S64) // @todo
// return // return
Arena :: struct Arena :: struct
// arena: Arena // arena: Arena
next: *Arena next: *Arena
data: *int data: *S64
len : S64 len : S64
cap : int cap : S64
Sub :: struct Sub :: struct
len: int len: S64
Sub_Sub :: struct Sub_Sub :: struct
len: int len: S64
get_len :: (s: *Arena): S64 // @todo get_len :: (s: *Arena): S64 // @todo
return s.next.len return s.next.len
@@ -35,8 +35,8 @@ Arena :: struct
string16: Str16 string16: Str16
String16 :: struct String16 :: struct
data: *Void data: *void
len : int len : S64
with_type: Arena = thing with_type: Arena = thing
pointer := &with_type pointer := &with_type
@@ -60,7 +60,7 @@ test_assignments :: ()
CONST :: 23 == 23 CONST :: 23 == 23
CONST_FLOAT :: 23.52 CONST_FLOAT :: 23.52
j: *int j: *S64
*j = 1 *j = 1
/* invalid /* invalid
8 = 32 8 = 32

View File

@@ -490,7 +490,7 @@ resolve_expr(Ast_Expr *ast, Ast_Resolved_Type *expected_type, Sym *lambda_to_res
Operand left = resolve_expr(node->expr); Operand left = resolve_expr(node->expr);
Operand index = resolve_expr(node->index); Operand index = resolve_expr(node->index);
if(left.type->kind != TYPE_ARRAY && left.type->kind != TYPE_POINTER) parsing_error(node->pos, "Indexing variable that is not an [Array] or [Pointer], it's of type %s instead", docname(left.type)); if(left.type->kind != TYPE_ARRAY && left.type->kind != TYPE_POINTER) parsing_error(node->pos, "Indexing variable that is not an [Array] or [Pointer], it's of type %s instead", docname(left.type));
if(!is_int(index.type)) type_error(node->pos, type_int, index.type,"Trying to index the array with invalid type, expected int"); if(!is_int(index.type)) type_error(node->pos, untyped_int, index.type,"Trying to index the array with invalid type, expected int");
return operand_lvalue(left.type->arr.base); return operand_lvalue(left.type->arr.base);
BREAK(); BREAK();
} }
@@ -630,11 +630,8 @@ resolve_expr(Ast_Expr *ast, Ast_Resolved_Type *expected_type, Sym *lambda_to_res
CASE(CAST, Cast){ CASE(CAST, Cast){
Operand expr = resolve_expr(node->expr); Operand expr = resolve_expr(node->expr);
Ast_Resolved_Type *type = resolve_typespec(node->typespec); Ast_Resolved_Type *type = resolve_typespec(node->typespec);
unused(expr);
if(type == expr.type); // @todo
else if(expr.type == type_int && type == type_bool) type = type_bool;
else if(expr.type == type_bool && type == type_int) type = type_int;
else parsing_error(node->pos, "Failed to cast, incompatible types");
return operand_rvalue(type); return operand_rvalue(type);
BREAK(); BREAK();
} }
@@ -842,7 +839,7 @@ resolve_const(Ast_Expr *ast, Sym *sym){
value = bigint_as_signed(&op.big_int_val) + 1; value = bigint_as_signed(&op.big_int_val) + 1;
} }
else{ else{
op.type = type_s64; op.type = untyped_int;
bigint_init_signed(&op.big_int_val, value++); bigint_init_signed(&op.big_int_val, value++);
} }
@@ -979,13 +976,13 @@ test_types(){
ctx.init(scratch, scratch); ctx.init(scratch, scratch);
pctx = &ctx; pctx = &ctx;
Ast_Resolved_Type *array_type1 = type_array(type_int, 32); Ast_Resolved_Type *array_type1 = type_array(type_s64, 32);
Ast_Resolved_Type *array_type2 = type_array(type_int, 32); Ast_Resolved_Type *array_type2 = type_array(type_s64, 32);
Ast_Resolved_Type *array_type3 = type_array(type_int, 48); Ast_Resolved_Type *array_type3 = type_array(type_s64, 48);
assert(array_type1 == array_type2); assert(array_type1 == array_type2);
assert(array_type2 != array_type3); assert(array_type2 != array_type3);
Ast_Resolved_Type *pointer_type1 = type_pointer(type_int); Ast_Resolved_Type *pointer_type1 = type_pointer(type_s64);
Ast_Resolved_Type *pointer_type2 = type_pointer(type_int); Ast_Resolved_Type *pointer_type2 = type_pointer(type_s64);
assert(pointer_type2 == pointer_type1); assert(pointer_type2 == pointer_type1);
Ast_Resolved_Type *pointer_type3 = type_pointer(pointer_type1); Ast_Resolved_Type *pointer_type3 = type_pointer(pointer_type1);
Ast_Resolved_Type *pointer_type4 = type_pointer(pointer_type2); Ast_Resolved_Type *pointer_type4 = type_pointer(pointer_type2);
@@ -993,17 +990,17 @@ test_types(){
assert(pointer_type3 == pointer_type4); assert(pointer_type3 == pointer_type4);
Array<Ast_Resolved_Type*> types = {scratch}; Array<Ast_Resolved_Type*> types = {scratch};
types.add(type_array(type_int, 32)); types.add(type_array(type_s64, 32));
Ast_Resolved_Type *func_type1 = type_lambda(0, types[0], types); Ast_Resolved_Type *func_type1 = type_lambda(0, types[0], types);
Ast_Resolved_Type *func_type2 = type_lambda(0, types[0], types); Ast_Resolved_Type *func_type2 = type_lambda(0, types[0], types);
assert(func_type1 == func_type2); assert(func_type1 == func_type2);
Array<Ast_Resolved_Type*> types2 = {scratch}; Array<Ast_Resolved_Type*> types2 = {scratch};
{ {
types2.add(type_array(type_int, 32)); types2.add(type_array(type_s64, 32));
types2.add(type_int); types2.add(type_s64);
} }
types.add(type_int); types.add(type_s64);
Ast_Resolved_Type *func_type3 = type_lambda(0, types[0], types); Ast_Resolved_Type *func_type3 = type_lambda(0, types[0], types);
Ast_Resolved_Type *func_type4 = type_lambda(0, types[0], types2); Ast_Resolved_Type *func_type4 = type_lambda(0, types[0], types2);
assert(func_type1 != func_type3); assert(func_type1 != func_type3);

View File

@@ -166,7 +166,6 @@ function void
sym_insert_builtins(){ sym_insert_builtins(){
sym_insert_builtin_type("void"_s , type_void); sym_insert_builtin_type("void"_s , type_void);
sym_insert_builtin_type("Bool"_s , type_bool); sym_insert_builtin_type("Bool"_s , type_bool);
sym_insert_builtin_type("int"_s , type_int);
sym_insert_builtin_type("String"_s, type_string); sym_insert_builtin_type("String"_s, type_string);
sym_insert_builtin_type("S8"_s, type_s8); sym_insert_builtin_type("S8"_s, type_s8);
sym_insert_builtin_type("S16"_s, type_s16); sym_insert_builtin_type("S16"_s, type_s16);
@@ -206,7 +205,7 @@ operand_type(Ast_Resolved_Type *type){
function Operand function Operand
operand_int(BigInt big_int){ operand_int(BigInt big_int){
Operand result = {}; Operand result = {};
result.type = type_int; result.type = untyped_int;
bigint_init_bigint(&result.big_int_val, &big_int); bigint_init_bigint(&result.big_int_val, &big_int);
result.is_const = true; result.is_const = true;
result.is_lvalue = false; result.is_lvalue = false;
@@ -333,7 +332,7 @@ function Ast_Resolved_Type *
type_enum(Ast_Enum *ast){ type_enum(Ast_Enum *ast){
Ast_Resolved_Type *type = resolve_typespec(ast->typespec, AST_CAN_BE_NULL); Ast_Resolved_Type *type = resolve_typespec(ast->typespec, AST_CAN_BE_NULL);
if(!type){ if(!type){
type = type_int; type = untyped_int;
} }
Ast_Resolved_Type *result = type_new(pctx->perm, TYPE_ENUM, type->size, type->align); Ast_Resolved_Type *result = type_new(pctx->perm, TYPE_ENUM, type->size, type->align);

35
types.h
View File

@@ -1,7 +1,3 @@
#define TYPE_INT_MIN S64MIN
#define TYPE_INT_MAX S64MAX
#define TYPE_UINT_MIN U64MIN
#define TYPE_UINT_MAX U64MAX
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Resolved Types // Resolved Types
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -12,13 +8,11 @@ enum Ast_Resolved_Type_Kind{
TYPE_UNTYPED_BOOL, // FIRST_TYPED_NUMERIC, FIRST_NUMERIC TYPE_UNTYPED_BOOL, // FIRST_TYPED_NUMERIC, FIRST_NUMERIC
TYPE_UNTYPED_INT, TYPE_UNTYPED_INT,
TYPE_UNTYPED_FLOAT, // LAST_TYPED_NUMERIC TYPE_UNTYPED_FLOAT, // LAST_TYPED_NUMERIC
TYPE_UNTYPED_STRING, // LAST_NUMERIC TYPE_UNTYPED_STRING,
TYPE_INT, // FIRST_NUMERIC TYPE_S64, // FIRST_NUMERIC
TYPE_S64,
TYPE_S32, TYPE_S32,
TYPE_S16, TYPE_S16,
TYPE_S8 , TYPE_S8 ,
TYPE_UINT,
TYPE_U64, TYPE_U64,
TYPE_U32, TYPE_U32,
TYPE_U16, TYPE_U16,
@@ -42,7 +36,7 @@ enum Ast_Resolved_Type_Kind{
TYPE_UNTYPED_FIRST_NUMERIC = TYPE_UNTYPED_BOOL, TYPE_UNTYPED_FIRST_NUMERIC = TYPE_UNTYPED_BOOL,
TYPE_UNTYPED_LAST_NUMERIC = TYPE_UNTYPED_FLOAT, TYPE_UNTYPED_LAST_NUMERIC = TYPE_UNTYPED_FLOAT,
TYPE_FIRST_NUMERIC = TYPE_INT, TYPE_FIRST_NUMERIC = TYPE_S64,
TYPE_LAST_NUMERIC = TYPE_BOOL, TYPE_LAST_NUMERIC = TYPE_BOOL,
}; };
@@ -63,12 +57,10 @@ const char *type_names[] = {
"[Untyped_Float]", "[Untyped_Float]",
"[Untyped_String]", "[Untyped_String]",
"[int]",
"[S64]", "[S64]",
"[S32]", "[S32]",
"[S16]", "[S16]",
"[S8]", "[S8]",
"[uint]",
"[U64]", "[U64]",
"[U32]", "[U32]",
"[U16]", "[U16]",
@@ -127,12 +119,10 @@ docname(Ast_Resolved_Type *type){
case TYPE_UNTYPED_INT: return "[Untyped_Int]"; case TYPE_UNTYPED_INT: return "[Untyped_Int]";
case TYPE_UNTYPED_FLOAT: return "[Untyped_Float]"; case TYPE_UNTYPED_FLOAT: return "[Untyped_Float]";
case TYPE_UNTYPED_STRING: return "[Untyped_String]"; case TYPE_UNTYPED_STRING: return "[Untyped_String]";
case TYPE_INT: return "[int]";
case TYPE_S64: return "[S64]"; case TYPE_S64: return "[S64]";
case TYPE_S32: return "[S32]"; case TYPE_S32: return "[S32]";
case TYPE_S16: return "[S16]"; case TYPE_S16: return "[S16]";
case TYPE_S8: return "[S8]"; case TYPE_S8: return "[S8]";
case TYPE_UINT: return "[uint]";
case TYPE_U64: return "[U64]"; case TYPE_U64: return "[U64]";
case TYPE_U32: return "[U32]"; case TYPE_U32: return "[U32]";
case TYPE_U16: return "[U16]"; case TYPE_U16: return "[U16]";
@@ -158,11 +148,8 @@ function const char *
name(Ast_Resolved_Type *type){ name(Ast_Resolved_Type *type){
switch(type->kind){ switch(type->kind){
case TYPE_VOID: return "void"; case TYPE_VOID: return "void";
case TYPE_INT: return "int";
case TYPE_UINT: return "uint";
case TYPE_BOOL: return "Bool"; case TYPE_BOOL: return "Bool";
case TYPE_STRING: return "String"; case TYPE_STRING: return "String";
case TYPE_F32: return "F32"; case TYPE_F32: return "F32";
case TYPE_F64: return "F64"; case TYPE_F64: return "F64";
case TYPE_S8: return "S8"; case TYPE_S8: return "S8";
@@ -191,13 +178,11 @@ global Ast_Resolved_Type type__type = {TYPE_TYPE};
global Ast_Resolved_Type type__f32 = {TYPE_F32, sizeof(F32), __alignof(F32)}; global Ast_Resolved_Type type__f32 = {TYPE_F32, sizeof(F32), __alignof(F32)};
global Ast_Resolved_Type type__f64 = {TYPE_F64, sizeof(F64), __alignof(F64)}; global Ast_Resolved_Type type__f64 = {TYPE_F64, sizeof(F64), __alignof(F64)};
global Ast_Resolved_Type type__int = {TYPE_INT, sizeof(S64), __alignof(S64)};
global Ast_Resolved_Type type__s8 = {TYPE_S8, sizeof(S8), __alignof(S8)}; global Ast_Resolved_Type type__s8 = {TYPE_S8, sizeof(S8), __alignof(S8)};
global Ast_Resolved_Type type__s16 = {TYPE_S16, sizeof(S16), __alignof(S16)}; global Ast_Resolved_Type type__s16 = {TYPE_S16, sizeof(S16), __alignof(S16)};
global Ast_Resolved_Type type__s32 = {TYPE_S32, sizeof(S32), __alignof(S32)}; global Ast_Resolved_Type type__s32 = {TYPE_S32, sizeof(S32), __alignof(S32)};
global Ast_Resolved_Type type__s64 = {TYPE_S64, sizeof(S64), __alignof(S64)}; global Ast_Resolved_Type type__s64 = {TYPE_S64, sizeof(S64), __alignof(S64)};
global Ast_Resolved_Type type__uint = {TYPE_UINT, sizeof(SizeU), __alignof(SizeU)};
global Ast_Resolved_Type type__u8 = {TYPE_U8, sizeof(U8), __alignof(U8)}; global Ast_Resolved_Type type__u8 = {TYPE_U8, sizeof(U8), __alignof(U8)};
global Ast_Resolved_Type type__u16 = {TYPE_U16, sizeof(U16), __alignof(U16)}; global Ast_Resolved_Type type__u16 = {TYPE_U16, sizeof(U16), __alignof(U16)};
global Ast_Resolved_Type type__u32 = {TYPE_U32, sizeof(U32), __alignof(U32)}; global Ast_Resolved_Type type__u32 = {TYPE_U32, sizeof(U32), __alignof(U32)};
@@ -216,13 +201,11 @@ global Ast_Resolved_Type *type_bool = &type__bool;
global Ast_Resolved_Type *type_f32 = &type__f32; global Ast_Resolved_Type *type_f32 = &type__f32;
global Ast_Resolved_Type *type_f64 = &type__f64; global Ast_Resolved_Type *type_f64 = &type__f64;
global Ast_Resolved_Type *type_int = &type__int;
global Ast_Resolved_Type *type_s8 = &type__s8 ; global Ast_Resolved_Type *type_s8 = &type__s8 ;
global Ast_Resolved_Type *type_s16 = &type__s16; global Ast_Resolved_Type *type_s16 = &type__s16;
global Ast_Resolved_Type *type_s32 = &type__s32; global Ast_Resolved_Type *type_s32 = &type__s32;
global Ast_Resolved_Type *type_s64 = &type__s64; global Ast_Resolved_Type *type_s64 = &type__s64;
global Ast_Resolved_Type *type_uint = &type__uint;
global Ast_Resolved_Type *type_u8 = &type__u8 ; global Ast_Resolved_Type *type_u8 = &type__u8 ;
global Ast_Resolved_Type *type_u16 = &type__u16; global Ast_Resolved_Type *type_u16 = &type__u16;
global Ast_Resolved_Type *type_u32 = &type__u32; global Ast_Resolved_Type *type_u32 = &type__u32;
@@ -242,10 +225,10 @@ force_inline B32 is_enum(Ast_Resolved_Type *a){return a->kind == TYPE_ENUM;}
force_inline B32 is_pointer(Ast_Resolved_Type *a){return a->kind == TYPE_POINTER;} force_inline B32 is_pointer(Ast_Resolved_Type *a){return a->kind == TYPE_POINTER;}
force_inline B32 is_string(Ast_Resolved_Type *a){return a->kind == TYPE_STRING || a->kind == TYPE_UNTYPED_STRING;} force_inline B32 is_string(Ast_Resolved_Type *a){return a->kind == TYPE_STRING || a->kind == TYPE_UNTYPED_STRING;}
force_inline B32 is_untyped_int(Ast_Resolved_Type *a){return a->kind == TYPE_UNTYPED_INT;} force_inline B32 is_untyped_int(Ast_Resolved_Type *a){return a->kind == TYPE_UNTYPED_INT;}
force_inline B32 is_typed_int(Ast_Resolved_Type *a){return (a->kind >= TYPE_INT && a->kind <= TYPE_U8);} force_inline B32 is_typed_int(Ast_Resolved_Type *a){return (a->kind >= TYPE_S64 && a->kind <= TYPE_U8);}
force_inline B32 is_int(Ast_Resolved_Type *a){return (a->kind >= TYPE_INT && a->kind <= TYPE_U8) || a->kind == TYPE_UNTYPED_INT;} force_inline B32 is_int(Ast_Resolved_Type *a){return (a->kind >= TYPE_S64 && a->kind <= TYPE_U8) || a->kind == TYPE_UNTYPED_INT;}
force_inline B32 is_signed_int(Ast_Resolved_Type *a){return a->kind >= TYPE_INT && a->kind <= TYPE_S8;} force_inline B32 is_signed_int(Ast_Resolved_Type *a){return a->kind >= TYPE_S64 && a->kind <= TYPE_S8;}
force_inline B32 is_unsigned_int(Ast_Resolved_Type *a){return a->kind >= TYPE_UINT && a->kind <= TYPE_U8;} force_inline B32 is_unsigned_int(Ast_Resolved_Type *a){return a->kind >= TYPE_U64 && a->kind <= TYPE_U8;}
force_inline B32 is_float(Ast_Resolved_Type *a){return a->kind == TYPE_F32 || a->kind == TYPE_F64 || a->kind == TYPE_UNTYPED_FLOAT;} force_inline B32 is_float(Ast_Resolved_Type *a){return a->kind == TYPE_F32 || a->kind == TYPE_F64 || a->kind == TYPE_UNTYPED_FLOAT;}
force_inline B32 is_f32(Ast_Resolved_Type *a){return a->kind == TYPE_F32;} force_inline B32 is_f32(Ast_Resolved_Type *a){return a->kind == TYPE_F32;}
force_inline B32 is_f64(Ast_Resolved_Type *a){return a->kind == TYPE_F64;} force_inline B32 is_f64(Ast_Resolved_Type *a){return a->kind == TYPE_F64;}
@@ -264,13 +247,11 @@ int_type_max(Ast_Resolved_Type *type){
switch(type->kind){ switch(type->kind){
case TYPE_BOOL: return 1; case TYPE_BOOL: return 1;
case TYPE_UNTYPED_BOOL: return 1; case TYPE_UNTYPED_BOOL: return 1;
case TYPE_UNTYPED_INT: return TYPE_INT_MAX; case TYPE_UNTYPED_INT: return S64MAX;
case TYPE_INT: return TYPE_INT_MAX;
case TYPE_S64: return S64MAX; case TYPE_S64: return S64MAX;
case TYPE_S32: return S32MAX; case TYPE_S32: return S32MAX;
case TYPE_S16: return S16MAX; case TYPE_S16: return S16MAX;
case TYPE_S8: return S8MAX; case TYPE_S8: return S8MAX;
case TYPE_UINT: return TYPE_UINT_MAX;
case TYPE_U64: return U64MAX; case TYPE_U64: return U64MAX;
case TYPE_U32: return U32MAX; case TYPE_U32: return U32MAX;
case TYPE_U16: return U16MAX; case TYPE_U16: return U16MAX;