Files
corelang/globals.kl
Krzosa Karol bcd825c154 New concept of AST_MODULE, Ast_File and Ast_Module are now both scopes.
Concept of loading and importing.
2022-06-13 13:39:31 +02:00

85 lines
2.9 KiB
Plaintext

lambdas :: #load "lambdas.kl"
Memory :: #load "enums.kl"
order :: #import "order1.kl"
test_load :: ()
new_types :: #load "new_types.kl"
new_types.basic_type_assignment()
arena: order.order2.Arena
//-----------------------------------------------------------------------------
// Function types
//-----------------------------------------------------------------------------
test_function :: (thing: S64): *S64
function_type: test_function
const_function_alias :: test_function
// null_function: (t: S64): *S64 = null
//-----------------------------------------------------------------------------
// Booleans
//-----------------------------------------------------------------------------
Boolean: Bool = true
//-----------------------------------------------------------------------------
// Nulls
//-----------------------------------------------------------------------------
// int_null: S64 = null
// str_null: String = null
// Bool_null: Bool = null
//-----------------------------------------------------------------------------
// Compound expressions
//-----------------------------------------------------------------------------
array1: [4]S64 = {1,2,3,4}
imp_array := [5]S64{1,2}
// imp_array_a := [5]S64{1,2,3,4,5,6}
// imp_array_b: [5]S64 = {1,2,3,4,5,6}
imp_array_c: [5]S64 = {[0] = 1, [2] = 2, [1] = 0} // @todo this should be illegal
// without_size: []S64 = {} // @todo: this should be slice, converting from array should be implicit
string: *char = "string"
first_letter := string[0]
decl_char: char = 55
//-----------------------------------------------------------------------------
// Pointers
//-----------------------------------------------------------------------------
pointer_decl : *S64
variable_from_deref: S64 = *pointer_decl
pointer_from_var : *S64 = &variable_from_deref
Boolean_pointer := &Boolean
//-----------------------------------------------------------------------------
// Implicit type
//-----------------------------------------------------------------------------
implicit_int :: 10
implicit_str :: "Hello world"
//-----------------------------------------------------------------------------
// Pointers
//-----------------------------------------------------------------------------
// pointer1: *S64 = 0
// pointer2: *S64 = pointer1
// pointer3: **S64 = 0
//-----------------------------------------------------------------------------
// String types
//-----------------------------------------------------------------------------
string1 :: "Test"
string2 :: string1
//-----------------------------------------------------------------------------
// Constant S64 variables
//-----------------------------------------------------------------------------
thing0 :: 10
thing4 :: thing0 + 11
thing3 :: thing4 + 20
combin :: thing0 + thing4 + thing3
Some :: struct
len: S64
cap: S64
some := Some{3, 2}
other := Some{len = 1, cap = 3}