Better tag assignment, emphasising that Embeddeds are real Values

This commit is contained in:
Tony Garnock-Jones 2022-06-12 09:32:02 +02:00
parent 8bb3f329a2
commit 3baade843d
2 changed files with 12 additions and 12 deletions

View File

@ -31,7 +31,7 @@ For a value `v`, we write `«v»` for the binary encoding of `v`.
e(v, d) = [v + d] if v < 128
e(v / 128, 0) ++ [(v % 128) + d] if v ≥ 128
«#!V» = [0xBF] ++ «V»
«#!V» = [0xAB] ++ «V»
The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and
8-byte IEEE 754 binary representations of `F` and `D`, respectively.
@ -50,4 +50,4 @@ decoder knows when to stop.
already be annotated) with some sequence of `Value`s `[v_1, ..., v_m]`,
surround `r` as follows:
[0xBE] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»
[0xBF] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»

View File

@ -178,25 +178,25 @@ The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and
### Embeddeds.
The `Repr` of an `Embedded` is the `Repr` of a `Value` chosen to
represent the denoted object, prefixed with `[0xBF]`.
represent the denoted object, prefixed with `[0xAB]`.
«#!V» = [0xBF] ++ «V»
«#!V» = [0xAB] ++ «V»
### Annotations.
To annotate a `Repr` `r` with some sequence of `Value`s `[v_1, ...,
v_m]`, surround `r` as follows:
[0xBE] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»
[0xBF] ++ len(|r|) ++ r ++ len(|«v_1»|) ++ «v_1» ++...++ len(|«v_m»|) ++ «v_m»
The `Repr` `r` *MUST NOT* already have annotations; that is, it must not begin with `0xBE`.
The `Repr` `r` *MUST NOT* already have annotations; that is, it must not begin with `0xBF`.
For example, the `Repr` corresponding to textual syntax `@a@b[]`, i.e.
an empty sequence annotated with two symbols, `a` and `b`, is
«@a @b []»
= [0xBE] ++ len(|«[]»|) ++ «[]» ++ len(|«a»|) ++ «a» ++ len(|«b»|) ++ «b»
= [0xBE, 0x81, 0xA8, 0x82, 0xA6, 0x61, 0x82, 0xA6, 0x62]
= [0xBF] ++ len(|«[]»|) ++ «[]» ++ len(|«a»|) ++ «a» ++ len(|«b»|) ++ «b»
= [0xBF, 0x81, 0xA8, 0x82, 0xA6, 0x61, 0x82, 0xA6, 0x62]
## Security Considerations
@ -274,11 +274,11 @@ undetermined number of `Value`s across, say, a TCP/IP connection:
A9 - Set
AA - Dictionary
(Ax) RESERVED AB-AF
AB - Embedded
(Bx) RESERVED B0-BD
BE - Annotations. {BE Lval val Lann0 ann0 Lann1 ann1 ...}
BF - Embedded
(Ax) RESERVED AC-AF
(Bx) RESERVED B0-BE
BF - Annotations. {BF Lval val Lann0 ann0 Lann1 ann1 ...}
## Appendix. Binary SignedInteger representation