Syntax Reference
Complete reference for the current ASUN text syntax.
Document Shapes
Single row:
{id@int, name@str}:(1, Alice)Multiple rows:
[{id@int, name@str}]:
(1, Alice),
(2, Bob)The schema appears before :. Data appears after : as one or more tuples.
Schema
Field syntax
{id, name, active}
{id@int, name@str, active@bool}In text ASUN, @ is the field binding marker. Scalar hints are optional. When present, the only scalar names are:
intfloatstrbool
For complex fields, the same @ marker is a required structural binding:
@{...}nested struct@[type]array@[{...}]array of structs
Examples:
{profile@{id@int, name@str}}
{tags@[str]}
{attrs@[{key@str, value@str}]}id and id@int are layout-equivalent, but profile@{...} and tags@[...] must keep @ so the parser can see the nested structure boundary.
Field names
Simple names may be unquoted:
{id, name, active}Quoted field names are required when a field name:
- contains spaces
- starts with digits
- contains syntax characters such as
{ } [ ] @ "
{"id uuid"@int, "65"@bool, "{}[]@\""@str}Data
Data is positional. Values follow schema order.
{id@int, name@str, active@bool}:(1, Alice, true)For nested structs, data is written as nested tuples:
{user@{id@int, name@str}}:((1, Alice))Inline object literals are not part of the current format.
Scalars
int
42
-7
0float
3.14
-0.5
1e10bool
true
falsenull / optional
An empty slot means null / absent:
{id@int, label@str}:(1, )Strings
Unquoted strings
Unquoted strings are allowed for simple values:
Alice
hello worldRules:
- outer whitespace is trimmed
- reserved syntax characters should be quoted instead
- if a value contains
@, quote it to avoid confusion with schema syntax
{name@str}:("@Alice")Quoted strings
Use quotes when you need to preserve whitespace or include reserved characters:
"value with, comma"
" leading spaces "
"line\nbreak"Supported escapes include \", \\, \n, \t, and \r.
Arrays
[{name@str, scores@[int]}]:
(Alice, [90, 85, 92]),
(Bob, [76, 88])Nested arrays are also allowed:
[{matrix@[[int]]}]:
([[1, 2], [3, 4]])Entry Lists
Write keyed collections as entry lists:
[{name@str, attrs@[{key@str, value@int}]}]:
(Alice, [(age, 30), (score, 95)])Comments
ASUN supports block comments:
/* user list */
[{id@int, name@str}]:
(1, Alice),
(2, Bob)Line comments are not part of the format.
Whitespace
- whitespace between structural tokens is ignored
- unquoted strings are trimmed at the outer edges
- pretty multi-line layout is recommended but not required