preserves/schema/schema.txt

55 lines
1.4 KiB
Plaintext

@<EmacsMode "-*- preserves -*-">
version 1 .
Schema = <schema {
version: Version
definitions: { symbol: Pattern ...:... }
}>.
; version 1 .
Version = 1 .
Pattern = <<or> [
; special builtins or <<atom> symbol>
<atom @atomKind <<or> [=Boolean =Float =Double =SignedInteger =String =ByteString =Symbol]>>
; =symbol, <<lit> any>, or plain non-symbol atom
<lit @value any>
; symbol
<ref @name symbol>
; Pattern / Pattern / ...
; <<or> [Pattern Pattern ...]>
; and the empty pattern is <<or> []>
<or @patterns [Pattern ...]>
; Pattern & Pattern & ...
; <<and> [Pattern Pattern ...]>
; and the universal pattern, "any", is <<and> []>
<and @patterns [Pattern ...]>
; <label a b c> ----> <rec <lit label> <tuple [<ref a> <ref b> <ref c>]>>
; except for record labels
; <<rec> x y> ---> <rec <ref x> <ref y>>
<rec @label Pattern @fields Pattern>
; [a b c] ----> <tuple [<ref a> <ref b> <ref c>]>
<tuple @patterns [NamedPattern ...]>
; [a b c ...] ----> <tuple* [<ref a> <ref b>] <ref c>]>
<tuple* @fixed [NamedPattern ...] @variable NamedPattern>
; #{p} ----> <setof <ref p>>
<setof @pattern Pattern>
; {k: v, ...:...} ----> <dictof <ref k> <ref v>>
<dictof @key Pattern @value Pattern>
; {a: b, c: d} ----> <dict {a: <ref b>, c: <ref d>}>
<dict @entries { any: Pattern ...:... }>
]>.
NamedPattern = <named @name symbol @pattern Pattern> / Pattern .