arctic/samples/syntax.atc

42 lines
975 B
Plaintext

#!/usr/bin/env arctic
# TODO: consider .ctc format instead?
@main
"data" # read-only memory
:values 'i10w10s10b10f10' # 1 each of int/word/short/byte/double in LE order
:hexval 'I10W10S10B10F10' # 1 each of int/word/short/byte/double in BE order
:bytes 'xffffffx' # 3 hexadecimal bytes
:string '"hello"' # 5 utf-8 encoded bytes
:array 'i1i2i3' # 3 int array
"state" # initialized read-write memory
:variable 'i10' # 1 int
:buffer 'i1i2i3' # 3 int array
"memory" # uninitialized read-write memory
:pool '{10}' # 10 byte pool
"constants" # ephemeral data
:const 'i10' # 1 universal integer
"macros" # ephemeral code
:foo '[
# body of foo here
]'
"code" # loaded code
:bar
# body of bar here
:main
:_baz # private label, not "exported" to other "code" sections
# body of baz here
"code" # more loaded code, but in here _baz not yet defined
# in general, all labels beginning with _ are section-local
"extern libfoo"
:foobar # loaded from either libfoo.a or libfoo.so