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