Starting from scratch on smaller scale, typechecking global and constant variables, compound expressions for arrays

This commit is contained in:
Krzosa Karol
2022-05-20 10:54:20 +02:00
parent d993623a50
commit 30736d37b6
12 changed files with 709 additions and 1307 deletions

58
test3.kl Normal file
View File

@@ -0,0 +1,58 @@
boolean: bool = true
value_of_bool: int = cast(boolean: int)
base := null
array1: [4]int = {1,2,3,4}
array2: [32]int = {1,2,3,4}
array3: [32]int = {
[0] = 0,
[31] = 31,
}
/*
pointer: *int
variable: int = *pointer
pointer_from_var := ^variable
pointer := &base
base_from_pointer := *pointer
structure: Data = {}
array2: [4]int = {
[0] = 0,
[1] = 1
}
array_to_pointer: *[4]int = &array1
array_to_pointer_imp : = &array1
*/
//-----------------------------------------------------------------------------
// Implicit type
//-----------------------------------------------------------------------------
implicit_int :: 10
implicit_str :: "Hello world"
//-----------------------------------------------------------------------------
// Pointers
//-----------------------------------------------------------------------------
pointer: *int = cast(null: *int)
pointer2: *int = null
pointer3: **int = null
//-----------------------------------------------------------------------------
// String types
//-----------------------------------------------------------------------------
string1 :: "Test"
string2 :: string1
//-----------------------------------------------------------------------------
// Constant int variables
//-----------------------------------------------------------------------------
thing0 :: 10
thing1 :: thing0 + 11
thing2 :: thing1 + 20
combin :: thing0 + thing1 + thing2