Commit Graph

54 Commits

Author SHA1 Message Date
Peter McGoron 0dab772a77 add decimal number to toplevel readtable 2024-10-13 10:48:30 -04:00
Peter McGoron b09ae09125 fix signs, make radix push more precise 2024-10-13 10:38:02 -04:00
Peter McGoron 798f70a2e9 add basic number reader (no compound numbers yet) 2024-10-13 10:33:04 -04:00
Peter McGoron f5bd882429 Revert "attempt to read numbers with a readtable"
This reverts commit 8d5a93a2da.
2024-10-13 10:32:28 -04:00
Peter McGoron 6950a2f4e5 add basic number reader 2024-10-13 10:32:01 -04:00
Peter McGoron 8d5a93a2da attempt to read numbers with a readtable
Saving this because I might use it. The implementation is fragile.

SCHEME numbers are in infix notation, so forcing them into the
readtable implementation (which works best for prefix operators) is
like fitting a square peg into a round hole.

I'm going to try tokenizing the expression and parsing using an
operator-precedence parser (things like "+", "@", and "." are infix
operators).
2024-10-05 22:36:06 -04:00
Peter McGoron 3a3da137cf read: make whitespace after "#" an error 2024-09-27 16:15:44 -04:00
Peter McGoron dfa320abb7 read: character constants 2024-09-27 16:14:37 -04:00
Peter McGoron 3c0508211f read: bytevectors 2024-09-27 15:45:30 -04:00
Peter McGoron b94e12ee33 read: hash constants and directives 2024-09-27 15:40:30 -04:00
Peter McGoron 0547488917 read: properly restore state when reading datum comments 2024-09-27 12:26:26 -04:00
Peter McGoron 5b609d4cdf read: document datum label 2024-09-27 12:15:16 -04:00
Peter McGoron b0ce282a30 read: change datum label to object, that returns an encapsulated datum label 2024-09-27 12:12:16 -04:00
Peter McGoron fee4198f2f read: add object encapsulating identifier 2024-09-27 11:26:30 -04:00
Peter McGoron df69826312 Revert "add object helper functions"
This reverts commit 0d5f4545d0.
2024-09-27 11:16:25 -04:00
Peter McGoron ba26544bec Revert "object: change to a stateful table"
This reverts commit 3c34c4a5a7.
2024-09-27 11:16:22 -04:00
Peter McGoron 625fdfeb39 Revert "object: rename"
This makes things much slower for questionable benefit. A better
version might use a hash table. A better interpreter would use
some form of partial evaluation to optimize the EQ? chain.

This reverts commit 4acea69841.
2024-09-27 11:15:35 -04:00
Peter McGoron 4acea69841 object: rename 2024-09-26 21:52:51 -04:00
Peter McGoron 3c34c4a5a7 object: change to a stateful table 2024-09-26 21:46:01 -04:00
Peter McGoron 0d5f4545d0 add object helper functions 2024-09-24 18:14:46 -04:00
Peter McGoron 06d19b2867 miniscm: string->symbol and symbol->string 2024-09-22 12:09:09 -04:00
Peter McGoron 194a1d01e3 add linked list library 2024-09-22 11:54:57 -04:00
Peter McGoron 3f9ba7c6ff read: add datum labels and UNCYCLE to cope with circular definitions 2024-09-22 11:48:26 -04:00
Peter McGoron 37355f1037 read: factor out ADD-ALL-AS-SKIP to UPDATE-LIST 2024-09-22 09:46:58 -04:00
Peter McGoron f52235cc51 read: datum comments 2024-09-22 00:49:18 -04:00
Peter McGoron 2e43f36471 read: block comments 2024-09-22 00:46:41 -04:00
Peter McGoron e109c255ad read: vectors 2024-09-22 00:00:26 -04:00
Peter McGoron 003d6dde05 read: factor out improper list reader 2024-09-21 23:52:55 -04:00
Peter McGoron 75f915d0e5 read: improper lists 2024-09-20 22:27:17 -04:00
Peter McGoron 5271cc67c6 readtable: add lists 2024-09-20 19:11:36 -04:00
Peter McGoron ac28546a29 miniscm: list->string 2024-09-08 12:01:18 -04:00
Peter McGoron 85e38a2b19 miniscm: add better support for immutable strings, and refactor to use real strings 2024-09-08 10:10:12 -04:00
Peter McGoron f26ab0db3f miniscm: add string-ref 2024-09-08 09:48:52 -04:00
Peter McGoron 775eb863ef readtable: handle EOF by returning EOF symbol 2024-09-08 08:46:15 -04:00
Peter McGoron 657db57826 readtable: comments 2024-09-08 08:44:42 -04:00
Peter McGoron 8bee2d39a4 readtable: simplify
After taking a look at the R7RS syntax and how Chicken parses
directives, I realized that it's easier to have "#!", "#\\", etc.
parse identifiers instead of baking in trie actions. This is slightly
slower but completely removes the trie concept from the readtable,
which simplifies the implementation and removes many corner cases
involving combining readtables with different action types.
2024-09-08 08:22:39 -04:00
Peter McGoron 6945841d1c readtable: case folding 2024-09-07 21:10:40 -04:00
Peter McGoron 3f56b03f1a readtable: when adding sequences to the readtable, push the last
read character back to the character reader before executing the
action.

This fixes the issue where sequences eat characters in front of them.
2024-09-07 19:41:22 -04:00
Peter McGoron 530dd18087 readtable: Normalize character handled by ACTIONs at the end of
sequences.

Previously, if "#true" and "#t" were in the readtable as sequences,
the string "#true" would call "#true"'s EXEC function after reading
"e", but it would call "#t"'s EXEC function after reading a
character after "t" (which could be EOF).

The new behavior normalizes everything so that the ACTIONs read the
character after the sequence.
2024-09-07 19:14:09 -04:00
Peter McGoron 42cd5a0678 readtable: add documentation for PUSH->READ 2024-09-07 18:44:18 -04:00
Peter McGoron 4d40be38d0 Readtable: fix propagation of default handlers in trie paths
Previous version did (ACTION 'UPDATE (CDR REST) ACTION) when a new
action had to be made. This caused default actions to propagate
through the trie.

While this isn't bad (it causes #TRU to be equal to #TRUE when that
was the last prefix in the tree), it can cause unexpected errors at
runtime, and no program should ever depend on its behavior.

The current solution is to make a new PASS readtable with a default
error action.
2024-09-07 18:37:17 -04:00
Peter McGoron 40b129b0db readtable: correctly add trie values. Incorrectly propogates default procedure 2024-09-07 17:58:18 -04:00
Peter McGoron 53a174f8e2 readtables, first pass 2024-09-07 17:47:10 -04:00
Peter McGoron f0cad72190 change around insert, delete, and update to hide representation 2024-09-05 21:18:04 -04:00
Peter McGoron 1e93de26d5 fix set and trie, add compat COND-EXPAND for chez 2024-09-05 03:03:22 -04:00
Peter McGoron c510054119 trie: add with test 2024-09-04 02:16:10 -04:00
Peter McGoron 40b03b5714 set:refactor maps 2024-09-04 01:18:35 -04:00
Peter McGoron ad49a18de5 set: add update 2024-09-04 00:54:11 -04:00
Peter McGoron 931cd50159 set: add insert multiple test 2024-08-31 10:53:29 -04:00
Peter McGoron f160ecaae1 add sets 2024-08-29 22:24:33 -04:00