summaryrefslogtreecommitdiff
path: root/doc/0/1-parse.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/0/1-parse.md')
-rw-r--r--doc/0/1-parse.md44
1 files changed, 22 insertions, 22 deletions
diff --git a/doc/0/1-parse.md b/doc/0/1-parse.md
index 54b1dd4..91407da 100644
--- a/doc/0/1-parse.md
+++ b/doc/0/1-parse.md
@@ -6,9 +6,9 @@ Zisp s-expressions represent an extremely minimal set of data types; only that
which is necessary to strategically construct more complex values:
+---------+--------+--------+
- | String | Rune | List |
+ | String | List | Rune |
+---------+--------+--------+
- | foobar | #name | (...) |
+ | foobar | (...) | #name |
+---------+--------+--------+
The parser recognizes various *syntax sugar* which abbreviates verbose syntax,
@@ -199,6 +199,26 @@ contain NUL bytes, in which case this optimization isn't used.) Longer strings
may be *interned* which is a feature explained further below. Otherwise, each
string is allocated separately, and represented by its unique memory address.
+### List
+
+A list is a sequence of values with a fixed length.
+
+A unique, contiguous array of values is allocated in program memory for each
+list of non-zero length, and the list as a value is then represented by the
+memory address of the array. The empty list is represented by a distinct
+canonical bit pattern.
+
+Lists are valid as a datum if one of the following holds true:
+
+* The list encodes a quoted string, datum label, or shebang line.
+
+* All values in the list are a valid datum, or it is empty.
+
+Further, a structure of nested list values may not contain cyclic references
+back up in the structure (which would make the above definition diverge into
+infinity). Such cycles must be broken up with datum labels, or else the list
+cannot be considered a datum, since it cannot be printed or parsed.
+
### Rune
A rune is represented by an ASCII character sequence of 1 to 6 bytes, that must
@@ -219,26 +239,6 @@ default decoder settings and documented explicitly as such.
Runes are always stored directly in a CPU word; never by memory address.
-### List
-
-A list is a sequence of values with a fixed length.
-
-A unique, contiguous array of values is allocated in program memory for each
-list of non-zero length, and the list as a value is then represented by the
-memory address of the array. The empty list is represented by a specific
-canonical bit pattern.
-
-Lists are valid as a datum if one of the following holds true:
-
-* The list encodes a quoted string, datum label, or shebang line.
-
-* All values in the list are a valid datum, or it is empty.
-
-Further, a structure of nested list values may not contain cyclic references
-back up in the structure (which would make the above definition diverge into
-infinity). Such cycles must be broken up with datum labels, or else the list
-cannot be considered a datum, since it cannot be printed or parsed.
-
## String interning