Commit Graph

59 Commits

Author SHA1 Message Date
sforman 8f3a4f3f07 Minor cleanup. 2023-10-24 09:49:42 -07:00
sforman 961d84173f Rearrange parser code.
It fits on a page now and reads well top-to-bottom.
2023-10-24 09:47:15 -07:00
sforman 4bb47c6b15 Fold in expect-right-bracket-lookahead 2023-10-23 22:50:57 -07:00
sforman 26725cefd8 Parse errors.
Convert error to abort to get the messages picked up by the exception
handler.
2023-10-21 20:05:11 -07:00
sforman 0a135e0f38 Runtime type checking for bool.
I think I'm going to retire bool in favor of e.g. 0= and null.
Booleans are already Boolean, of course, and symbols should not be
expected to have a valid interpretation in a Boolean context (I think?)
2023-10-21 19:25:14 -07:00
sforman bd55214a52 Runtime type checking for rest of core; inscribe. 2023-10-21 19:13:59 -07:00
sforman 3c1d5ac361 joy-dup 2023-10-21 12:40:30 -07:00
sforman 35a122b2ba Runtime type checking for comparison ops.
Because we're using Scheme Booleans for Thun Booleans there's no need to
make a special function for these, we can reuse the one for math ops.
2023-10-21 12:17:21 -07:00
sforman 6bd9249f83 Runtime type checking for math ops. 2023-10-21 12:11:06 -07:00
sforman d76c23dce2 joy-first 2023-10-21 11:10:36 -07:00
sforman 8bb8953816 pop-any and pop-list.
Runtime type-checking.
2023-10-21 11:08:01 -07:00
sforman 3e72ce494a minor edits 2023-10-20 22:16:21 -07:00
sforman 0fcd217f2c A little BTree.
Persistent (immutable) datastructure.
2023-10-20 19:36:41 -07:00
sforman b116c2c98b A start on error reporting.
I outfitted `rest` with some error reporting and tried out exception
handling.  So far so good.

One issue is that the dictionary is not a persistent datastructure, so
if there was an "inscribe" command (it's not yet implemented for this
Scheme implementation) that might be slightly problematical.  (If an
error were to occur in an evaluation that had already entered new
definitions into the dict then those definitions would "survive" into
the rest of the REPL session (or whatever.))

I'll look into persistent dict for Scheme.
2023-10-20 11:42:50 -07:00
sforman d0623508bd Use Scheme symbols for Thun symbols.
It seems more elegant that way, but I haven't tested it to find out if
it has better performance or memory usage (yet.)
2023-10-19 20:54:11 -07:00
sforman 7f5c1d3086 Symbols for symbols.
This shouldn't work yet, because the parser makes Lisp symbols out of
the Thun symbols, but the match expr still has strings.  In the REPL
this fails, but in the compiled Joy binary it doesn't fail, the
interpreter interprets just fine.
2023-10-15 11:41:44 -07:00
sforman 68a85c915a add defs for select and small; cleaner joy-func. 2023-10-13 07:42:22 -07:00
sforman 205086714d A little more match. 2023-10-11 20:36:01 -07:00
sforman c4d80f6c4e Use match a little more. 2023-10-11 20:13:02 -07:00
sforman 93556efeeb Use match instead of cond. 2023-10-11 20:01:35 -07:00
sforman 8e15a657ed Minor indentation change, a typo. 2023-10-10 12:12:07 -07:00
sforman 4df31667b6 Remove global stack, dict.
Pass them through the recursive loop instead.
2023-10-10 11:16:30 -07:00
sforman 937f6bfce5 Put a bang on add-def. 2023-10-10 10:45:00 -07:00
sforman 506b40bba4 min and max 2023-10-09 13:04:16 -07:00
sforman da0e1e685e Derive `zip`. 2023-10-09 11:45:28 -07:00
sforman d833f1a3e9 Implement `bool` and trace for Scheme. 2023-10-08 17:57:05 -07:00
sforman 16cc0e5769 Change definition of uncons. 2023-09-18 11:26:50 -07:00
sforman 8dfcbca2a8 README for Chicken Scheme. 2023-08-20 10:24:29 -07:00
sforman 5edf0797b4 sort 2023-08-18 17:09:08 -07:00
sforman 20b517f083 Figlet headings. 2023-08-18 16:59:32 -07:00
sforman 48e443c5c7 for-each 2023-08-12 14:09:44 -07:00
sforman 596a7a21eb A crude main loop.
I know there are better ways to do this, but I don't know what they are
yet.  Maybe a "do" loop?  Anyway, this works, although it doesn't catch
errors yet.
2023-08-12 13:03:42 -07:00
sforman 8bbbd2a4a4 Update defs.scm 2023-08-12 08:26:59 -07:00
sforman 00f4bfcacd Math ops, definitions for left- and right-shift. 2023-08-12 08:04:21 -07:00
sforman f45c739fad first rest 2023-08-11 23:02:46 -07:00
sforman 1a37a8e81c concat cons comparison 2023-08-11 22:48:25 -07:00
sforman 8df8634e39 loop 2023-08-11 21:27:41 -07:00
sforman 172407fef1 branch and refactor simple functions.
The refactor should be a macro but I don't know how to write those yet
(apparently there are different macros systems...  ooo la la!)
2023-08-11 21:15:26 -07:00
sforman 4d6d66e391 dip 2023-08-11 20:49:24 -07:00
sforman c3e6c1be90 i 2023-08-11 20:45:25 -07:00
sforman ae7d854330 swap 2023-08-11 20:38:01 -07:00
sforman 9fbb7c05c3 pop 2023-08-11 20:34:40 -07:00
sforman b921a9e3d2 stack, swaack 2023-08-11 11:11:51 -07:00
sforman 5f8e33ff8d Add copyleft notice. 2023-08-11 11:03:00 -07:00
sforman 3382d0a47e Load defs at compile time.
I don't really know the proper way to do this, but I managed to whump
something up.
2023-08-11 10:48:33 -07:00
sforman 8fab04b02e Evaluate definitions. 2023-08-11 10:31:53 -07:00
sforman 67b60be123 Convert defs.txt to defs.scm.
Gonna need a makefile.
2023-08-11 10:15:31 -07:00
sforman d014709a32 Load defs from defs.txt.
They are loaded at runtime though :(  shouldn't be too hard to fix that?
2023-08-11 08:50:00 -07:00
sforman b6c3c364d0 A start on dictionaries using srfi-69 hash tables. 2023-08-10 21:49:37 -07:00
sforman 19777a86ae Use '->' in names of functions that convert values. 2023-08-10 21:48:46 -07:00