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
26
27
28
29
30
31
32
33
34
35
|
import "libc.hff";
bitfield Foo : u16 {
tag 3,
flag (3, 1) bool,
num 10 signed,
}
#{
Test block comment,
contains tokens " ",
this does not end the comment -> '}'
8ab
#test
i`m having to use backtick instead of single quote for the apostrophe in this phrase,
so the main use is for commenting out code,
and inline comments to annotate e.g. parameter names
}
extern fn main() int {
let foo Foo = {};
printf("0x%X: %d, %d, %d\n", foo.#raw, foo.tag, foo.flag, foo.num);
foo.tag = 3;
printf("%d\n", foo.#raw += 1);
--foo.tag;
foo.flag = #t;
foo.num = -2;
foo.num *= 10;
printf("0x%X: %d, %d, %d\n", foo.#raw, foo.tag, foo.flag, foo.num += 532);
let long = "abcd" "defg";
static const foop Foo = {7,#t,3, .tag: 9};
printf("0x%X: %d, %d, %d\n", foop.#raw, foop.tag, foop.flag, foop.num);
}
|