45 lines
2.0 KiB
Markdown
45 lines
2.0 KiB
Markdown
|
```text
|
||
|
Document := Value ws
|
||
|
Value := ws (Record | Collection | Atom | Embedded | Annotated)
|
||
|
Collection := Sequence | Dictionary | Set
|
||
|
Atom := Boolean | ByteString | String | QuotedSymbol | Symbol | Number
|
||
|
ws := (space | tab | cr | lf | `,`)*
|
||
|
|
||
|
Record := `<` Value+ ws `>`
|
||
|
Sequence := `[` Value* ws `]`
|
||
|
Dictionary := `{` (Value ws `:` Value)* ws `}`
|
||
|
Set := `#{` Value* ws `}`
|
||
|
|
||
|
Boolean := `#t` | `#f`
|
||
|
ByteString := `#"` binchar* `"`
|
||
|
| `#x"` (ws hex hex)* ws `"`
|
||
|
| `#[` (ws base64char)* ws `]`
|
||
|
String := `"` («any unicode scalar except `\` or `"`» | escaped | `\"`)* `"`
|
||
|
QuotedSymbol := `|` («any unicode scalar except `\` or `|`» | escaped | `\|`)* `|`
|
||
|
Symbol := (`A`..`Z` | `a`..`z` | `0`..`9` | sympunct | symuchar)+
|
||
|
Number := Float | Double | SignedInteger
|
||
|
Float := flt (`f`|`F`) | `#xf"` (ws hex hex)4 ws `"`
|
||
|
Double := flt | `#xd"` (ws hex hex)8 ws `"`
|
||
|
SignedInteger := int
|
||
|
|
||
|
Embedded := `#!` Value
|
||
|
Annotated := Annotation Value
|
||
|
Annotation := `@` Value | `;` «any unicode scalar except cr or lf»* (cr | lf)
|
||
|
|
||
|
escaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\u` hex hex hex hex
|
||
|
binescaped := `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\x` hex hex
|
||
|
binchar := «any scalar ≥32 and ≤126, except `\` or `"`» | binescaped | `\"`
|
||
|
base64char := `A`..`Z` | `a`..`z` | `0`..`9` | `+` | `/` | `-` | `_` | `=`
|
||
|
sympunct := `~` | `!` | `$` | `%` | `^` | `&` | `*` | `?`
|
||
|
| `_` | `=` | `+` | `-` | `/` | `.`
|
||
|
symuchar := «any scalar value ≥128 whose Unicode category is
|
||
|
Lu, Ll, Lt, Lm, Lo, Mn, Mc, Me, Nd, Nl, No, Pc,
|
||
|
Pd, Po, Sc, Sm, Sk, So, or Co»
|
||
|
|
||
|
flt := int ( frac exp | frac | exp )
|
||
|
int := (`-`|`+`) (`0`..`9`)+
|
||
|
frac := `.` (`0`..`9`)+
|
||
|
exp := (`e`|`E`) (`-`|`+`) (`0`..`9`)+
|
||
|
hex := `A`..`F` | `a`..`f` | `0`..`9`
|
||
|
```
|