blob: d88a2238561fb5bf9981b03dc3c0d75a3e66cdb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
fwrite ::= #foreign("fwrite", "libc.so.6") fn (#C &"void const", #C size_t, #C size_t, &u8) #C size_t;
fputc ::= #foreign("fputc", "libc.so.6") fn (#C int, &u8) #C int;
writes ::= fn(x : []char) {
fwrite(&x[0], 1, x.len as u64, #builtin("stdout"));
};
puts ::= fn(x : []char) {
writes(x);
fputc('\n' as i32, #builtin("stdout"));
};
hw ::= fn() int {
writes("Hello,");
if #builtin("compiling") {
writes(" compiling");
}
puts(" world!");
3
};
main ::= fn() {
hw();
x ::= hw();
};
|