diff options
Diffstat (limited to 'doc/0/1-parse.md')
| -rw-r--r-- | doc/0/1-parse.md | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/doc/0/1-parse.md b/doc/0/1-parse.md index 95a22bb..4943f1a 100644 --- a/doc/0/1-parse.md +++ b/doc/0/1-parse.md @@ -505,29 +505,22 @@ Notes: * The terms datum, dat1, and dat2 each refer to an arbitrary datum; ellipsis means zero or more data. -* The `#datum` form only applies when the datum following the hash sign is +* The `#<datum>` form only applies when the datum following the hash sign is anything other than a bare string, since otherwise this would be ambiguous with a rune literal. A bare string can nevertheless follow the hash sign by separating the two with a backslash: #\string -> (#HASH string) -* Though not represented in the table due to notational difficulty, the form - `#rune(...)` doesn't require a list in the second position; any datum that - works with the `#datum` syntax also works with `#rune<DATUM>`. +* Likewise, `#rune<datum>` only works for a datum that is not a bare string, + since otherwise it is impossible to tell where the rune ends and where the + bare string begins. - #rune1#rune2 -> (#rune1 #rune2) - - #rune\string -> (#rune string) - - #rune'string -> (#rune (#QUOTE string)) - - #rune"string" -> (#rune (#DQSTR |string|)) + #abcdefgh ;Could be (#abcdef gh) or (#abcde fgh) or ... - As a counter-example, following a rune immediately with a bare string isn't - possible without the delimiting backslash, since that would be ambiguous: + The backslash works here as well: - #abcdefgh ;Could be (#abcdef gh) or (#abcde fgh) or ... + #abcd\efgh -> (#abcd efgh) * Syntax sugar can combine arbitrarily. Some examples follow. Any of these may or may not actually have a meaning in code; some might simply end up producing @@ -543,9 +536,11 @@ Notes: foo.bar.baz{x y} -> (#JOIN (#JDOT (#JDOT foo bar) baz) (#CRBRAC x y)) -* Those used to thinking in Lisp and Scheme may think that `(#QUOTE ...)` halts - further decoding of enclosed data. This is not so, since quoting is related - to code evaluation, not decoding. +* Those used to Lisp and Scheme may think that `(#QUOTE ...)` halts decoding of + enclosed data. This is not so, since quoting as a concept is related to code + evaluation, not decoding. Decoding simply implements what would be reader + macros or reader syntax in Lisp and Scheme. Also, decoding is effectively + done in depth-first order. ### Datum labels @@ -579,8 +574,7 @@ For clarity, concrete examples follow: +-------------------+------------------------------+ Here, the visual token `<0x1234abcd>` stands for a Zisp value of a numeric type -with an integer value. Note that the decoder may not accept a bare string here, -meaning this syntax sugar is not merely an abbreviation. +with an integer value. ### Shebang |
