49 lines
1015 B
Plaintext
49 lines
1015 B
Plaintext
|
|
a_type :: int
|
|
pointer_type :: *int
|
|
null_pointer: pointer_type = null
|
|
|
|
if_stmt :: (cond: int): type
|
|
CONSTANT :: 10
|
|
thing := 10
|
|
if i := thing + cond, cond + CONSTANT
|
|
return i + CONSTANT
|
|
else if cond - CONSTANT
|
|
return i - CONSTANT
|
|
else
|
|
return CONSTANT
|
|
|
|
|
|
add_10 :: (size: int): int
|
|
// @todo: before the generation c pass, each stage should have it's own
|
|
// tree transformation phase, where it yanks functions etc.
|
|
add_20 :: (new_size: int): int
|
|
return 20
|
|
|
|
add :: (a: int, b: int = 10): int
|
|
return a + b
|
|
|
|
constant :: 20; result := constant + 10
|
|
|
|
v1 := add(a = 1)
|
|
v2 := add(a = 1, b = 2)
|
|
v3 := add([0] = 1)
|
|
v4 := add(b = 1, a = 2)
|
|
v5 := add([0] = 1, [1] = 2)
|
|
// v_err := add([0] = 1, 10) // illegal
|
|
// v_err := add([1] = 1) // illegal
|
|
// v_err := add() // illegal
|
|
|
|
return v3
|
|
|
|
return_constant :: (): int
|
|
constant :: 10
|
|
return constant
|
|
|
|
returning_void :: (insert: int)
|
|
val1: int = return_constant()
|
|
val2: int = add_10(val1)
|
|
return
|
|
|
|
|
|
type :: a_type |