From b0043e83d3bf2f4d49bf1f153d65c48b4fabb4f6 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Thu, 2 Jul 2026 00:19:38 +0200 Subject: Further doc improvements. --- doc/0/1-parse.md | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'doc/0/1-parse.md') 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 `#` 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`. +* Likewise, `#rune` 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 -- cgit v1.2.3