; the actual parser impl accepts a superset of this syntax, actually
; think of this syntax as a "declaration of intent"
; rather than an ultimate truth
script = *(*stmt-delim (stmt stmt-delim / comment) *stmt-delim)
comment = "#" *(VCHAR / hsp) newline
stmt = command hsp args
command = "create" hsp actor / "pay" / "deliver" / "balance"
actor = "entity" / "concept" / "object"
args = arg *(hsp arg)
arg = arg-named / arg-pos
arg-named = ident osp "=" osp value
arg-pos = value
value = money / ratio / gtin / name
money = cents / euros
cents = nat osp sign-ct
euros = (decimal / nat) osp sign-eur
sign-eur = "€" / "eur" / "EUR" / "euros"
sign-ct = "¢" / "ct" / "cent" / "cents"
split = nat osp ":" osp nat
; not entirely correct but eh
gtin = 8*14DIGIT
name = ident
; basics
ident = ? Default Identifier as per https://www.unicode.org/reports/tr31/#Default_Identifier_Syntax ?
decimal = nat "." 2DIGIT
nat = 1*DIGIT
; whitespace
; Statement delimiter.
stmt-delim = osp (";" / newline) osp
newline = LF / CRLF
; Optional (can be, but doesn't have to)
osp = *WSP
; Hard (at least one)
hsp = 1*WSP
; one-character
alnum = ALPHA / DIGIT
nonzero = %x31-39