Restructure
This commit is contained in:
64
programs/lambdas.kl
Normal file
64
programs/lambdas.kl
Normal file
@@ -0,0 +1,64 @@
|
||||
Test :: struct
|
||||
len: S64
|
||||
|
||||
|
||||
test: Test
|
||||
member := test.len
|
||||
|
||||
enum_val: Memory.Allocator_Kind = Memory.Allocator_Kind.Heap
|
||||
other_enum_val: S64 = enum_val->S64
|
||||
|
||||
a_type :: S64
|
||||
pointer_type :: *S64
|
||||
// null_pointer: pointer_type = null
|
||||
|
||||
if_stmt :: (cond: S64): type
|
||||
CONSTANT :: 10
|
||||
thing := 10
|
||||
if i := thing + cond, cond > CONSTANT
|
||||
return i + CONSTANT
|
||||
else if cond < CONSTANT
|
||||
return i - CONSTANT
|
||||
else
|
||||
return CONSTANT
|
||||
|
||||
|
||||
for_stmt :: ()
|
||||
for i := 0, i < 10, i+=1
|
||||
out_of_order_resolving()
|
||||
|
||||
out_of_order_resolving :: ()
|
||||
i := 10
|
||||
|
||||
add_10 :: (size: S64): S64
|
||||
add_20 :: (new_size: S64): S64
|
||||
return 20
|
||||
|
||||
add :: (a: S64, b: S64 = 10): S64
|
||||
return a + b
|
||||
|
||||
constant :: 20; result := constant + 10
|
||||
|
||||
v3 := add(1,2)
|
||||
// v2 := add(a = 1, b = 2)
|
||||
// v1 := add(a = 1)
|
||||
// // v_err := add([0] = 1)
|
||||
// v4 := add(b = 1, a = 2)
|
||||
// // v_err := add([0] = 1, [1] = 2)
|
||||
// // v_err := add([0] = 1, 10) // illegal
|
||||
// // v_err := add([1] = 1) // illegal
|
||||
// // v_err := add() // illegal
|
||||
v4 := constant
|
||||
return v4
|
||||
|
||||
return_constant :: (): S64
|
||||
constant :: 10
|
||||
return constant
|
||||
|
||||
returning_void :: (insert: S64)
|
||||
// val1: S64 = return_constant()
|
||||
// val2: S64 = add_10(val1)
|
||||
return
|
||||
|
||||
|
||||
type :: a_type
|
||||
Reference in New Issue
Block a user