Commit Graph

521 Commits

Author SHA1 Message Date
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 735ee73515 Remake C version. 2023-10-23 22:50:44 -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 787dc6a7b3 Nerd Sniped 2023-10-09 11:44:13 -07:00
sforman 04d3e96a99 Great progress! 2023-10-08 20:17:02 -07:00
sforman eb665f2b50 More work on Ref doc, & stuff. 2023-10-08 17:58:22 -07:00
sforman d833f1a3e9 Implement `bool` and trace for Scheme. 2023-10-08 17:57:05 -07:00
sforman 4821ea0ee2 Take the right number of things off of the stack. 2023-10-08 13:08:34 -07:00
sforman 0e380b7748 Div, mod handle zero. 2023-09-23 21:20:37 -07:00
sforman 20b5f05d29 Elm reformatting and demo HTML page. 2023-09-23 09:37:43 -07:00
sforman 16cc0e5769 Change definition of uncons. 2023-09-18 11:26:50 -07:00
sforman 68488cc9d2 Elm version using BigNums.
This went pretty smoothly, I just followed the compiler errors after
substituting Integer for Int in the type definition.

The only tricky thing is that the div and mod functions for Integer
return Maybe Integer rather than just Integer, so I need to wrap those
or something?  (For now I just put in add to get it to compile.)

Oh, and "not equal" is not correct? The compiler didn't complain.
2023-09-02 11:30:18 -07:00
sforman 10c1d6ccde Let's use bignums. 2023-09-02 11:11:42 -07:00
sforman 4f27f3305f Don't use andThen.
It's less clear than spelling it all out.
2023-09-02 09:44:57 -07:00
sforman b65e948cce Chaining with andThen works but is ugly.
It's lees clear to me what's going on, and I wrote it.
2023-09-02 09:38:15 -07:00
sforman e956e177f6 Rebuilt C. 2023-08-30 19:57:57 -07:00
sforman 18adfa2205 Compiling Thun to Python.
Not all of the words that compiled with the old defs.txt compiled with
the latest, so we're keeping the old one in here until I can trace down
the issues.
2023-08-30 18:54:49 -07:00
sforman 9c4ecb085b pow 2023-08-30 18:52:26 -07:00
sforman 35097d90a9 Update Nim defs.txt. 2023-08-30 18:46:51 -07:00
sforman 47275cf1f1 Simple linear power function. 2023-08-30 18:44:55 -07:00
sforman fb8faf917d THe old compiler-to-Python. 2023-08-30 16:57:48 -07:00
sforman 6674fdffb6 Better exceptions. 2023-08-28 20:46:19 -07:00
sforman a107e1df6c Rebuilt C interpreter. 2023-08-21 09:53:24 -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 307a421fab Add definition for xor. 2023-08-16 10:05:30 -07:00
sforman 60bddcc70e cleanup 2023-08-13 08:49:20 -07:00