summaryrefslogtreecommitdiff
path: root/doc/0/1-parse.md
diff options
context:
space:
mode:
authorTaylan Kammer <taylan.kammer@gmail.com>2026-06-27 09:41:01 +0200
committerTaylan Kammer <taylan.kammer@gmail.com>2026-06-27 09:41:01 +0200
commit831ff8ddfbc1d22c051c15940afd4c0eb7eb92fc (patch)
treee7078fb0b9e2ef681d5ffa0747f69a18e163ebcb /doc/0/1-parse.md
parent15a03f90ae86f1dc75224405904c1f2ba4f57176 (diff)
Improvements to latest design changes.
Diffstat (limited to 'doc/0/1-parse.md')
-rw-r--r--doc/0/1-parse.md28
1 files changed, 10 insertions, 18 deletions
diff --git a/doc/0/1-parse.md b/doc/0/1-parse.md
index b8f1c2d..54b1dd4 100644
--- a/doc/0/1-parse.md
+++ b/doc/0/1-parse.md
@@ -221,43 +221,35 @@ 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, and the list as a value
-is then represented by the memory address of the array.
+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 the list is empty.
+* 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.
-Lists can actually be represented by two distinct value types, depending on how
-the parser is configured:
-
-1. Data lists: Allocated in the regular heap region, with a metadata header
- allowing for an arbitrary length up to the general heap size constraints;
- subject to automatic memory reclamation.
-
-2. Code lists: Allocated in a dedicated region of program memory, without any
- padding or metadata header (maximally memory-dense), using a 16-bit length
- tag directly within the pointer and thus limited to 65,535 elements; not
- subject to automatic memory reclamation!
-
## String interning
Departing from Lisp tradition, Zisp doesn't use a separate *symbol* data type.
Instead, when the parser is configured for code input, it enables *interning*
-with a configurable upper limit of up to 65,535 bytes for interned strings.
+for all strings up to 255 bytes in length.
Interning means that any occurrence of the same string -- equal in length and
containing the same bytes -- ends up being represented by the same bit-pattern
-by use of a hash-set to identify reoccurring strings.
+by use of a hash-set to identify reoccurring strings; the same strategy used
+with symbols, but applied to all strings.
The quotation method is inconsequential to this process; for example, while
`|foo bar|` and `"foo bar"` will parse into different list values due to the