- intrinsics from the registry as plain calls: fallible ones are outcome matches or `or trap` (E7006 otherwise), infallible ones plain calls - resource operands by name, borrowed mut for the one operation and ended on every edge; a mut binding/parameter passes as is; `mut f` is E7006 - closes consume with `move` (E7003); no inserted closes (E3002/E3001) - data operands explicit (ref/mut/byte string, E7005 otherwise) - file<…>, stream, listener types; cap.narrow.prefix with cap_error edges - ref/mut unchecked s[i] (also as a binding) and assume(c) under effects [unsafe]; boundary left to the verifier (E6001) - trusted is reserved and rejected (E7006) - parameter names preserved; generated names avoid them (normative) - parser: >> closes two type arguments - conformance: `equivalent:` compares the run record with a reference AIR program (hello, file_copy, tcp_echo, narrow ok/not_subset/invalid, random) - spec 15, grammar, quick reference (io_error match fixed), plan, examples
79 lines
1.9 KiB
Plaintext
79 lines
1.9 KiB
Plaintext
module demo.hello
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, capabilities, effects, ownership, resources]
|
|
|
|
fn @main(%out: cap<io.write>) -> void
|
|
effects [io.write]
|
|
entry:
|
|
%bytes_1 = local.alloc array<u8, 11>
|
|
local.zero %bytes_1
|
|
%w_2 = borrow.mut %bytes_1
|
|
%i_3 = const.usize 0
|
|
%c_4 = const.u8 104
|
|
%e_5 = borrow.index %w_2, %i_3
|
|
store %e_5, %c_4
|
|
borrow.end %e_5
|
|
%i_6 = const.usize 1
|
|
%c_7 = const.u8 101
|
|
%e_8 = borrow.index %w_2, %i_6
|
|
store %e_8, %c_7
|
|
borrow.end %e_8
|
|
%i_9 = const.usize 2
|
|
%c_10 = const.u8 108
|
|
%e_11 = borrow.index %w_2, %i_9
|
|
store %e_11, %c_10
|
|
borrow.end %e_11
|
|
%i_12 = const.usize 3
|
|
%c_13 = const.u8 108
|
|
%e_14 = borrow.index %w_2, %i_12
|
|
store %e_14, %c_13
|
|
borrow.end %e_14
|
|
%i_15 = const.usize 4
|
|
%c_16 = const.u8 111
|
|
%e_17 = borrow.index %w_2, %i_15
|
|
store %e_17, %c_16
|
|
borrow.end %e_17
|
|
%i_18 = const.usize 5
|
|
%c_19 = const.u8 44
|
|
%e_20 = borrow.index %w_2, %i_18
|
|
store %e_20, %c_19
|
|
borrow.end %e_20
|
|
%i_21 = const.usize 6
|
|
%c_22 = const.u8 32
|
|
%e_23 = borrow.index %w_2, %i_21
|
|
store %e_23, %c_22
|
|
borrow.end %e_23
|
|
%i_24 = const.usize 7
|
|
%c_25 = const.u8 97
|
|
%e_26 = borrow.index %w_2, %i_24
|
|
store %e_26, %c_25
|
|
borrow.end %e_26
|
|
%i_27 = const.usize 8
|
|
%c_28 = const.u8 106
|
|
%e_29 = borrow.index %w_2, %i_27
|
|
store %e_29, %c_28
|
|
borrow.end %e_29
|
|
%i_30 = const.usize 9
|
|
%c_31 = const.u8 105
|
|
%e_32 = borrow.index %w_2, %i_30
|
|
store %e_32, %c_31
|
|
borrow.end %e_32
|
|
%i_33 = const.usize 10
|
|
%c_34 = const.u8 10
|
|
%e_35 = borrow.index %w_2, %i_33
|
|
store %e_35, %c_34
|
|
borrow.end %e_35
|
|
borrow.end %w_2
|
|
%b_36 = borrow.ref %bytes_1
|
|
%s_37 = slice.make %b_36
|
|
intrinsic io.stdout_write(%out, %s_37), ok -> @ok_38, err -> @err_39
|
|
ok_38:
|
|
borrow.end %s_37
|
|
borrow.end %b_36
|
|
ret
|
|
err_39(%err_40: io_error):
|
|
borrow.end %s_37
|
|
borrow.end %b_36
|
|
trap
|