Thun/implementations/scheme-chicken
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
..
.gitignore Evaluate definitions. 2023-08-11 10:31:53 -07:00
Makefile Load defs at compile time. 2023-08-11 10:48:33 -07:00
README.md README for Chicken Scheme. 2023-08-20 10:24:29 -07:00
btree.scm A little BTree. 2023-10-20 19:36:41 -07:00
defs.scm Symbols for symbols. 2023-10-15 11:41:44 -07:00
generate_defs.scm Convert defs.txt to defs.scm. 2023-08-11 10:15:31 -07:00
joy.scm Runtime type checking for bool. 2023-10-21 19:25:14 -07:00

README.md

Thun

This version is written in Chicken Scheme. This is my first Scheme code (first Lisp code, for that matter) so there's probably a lot of non-idomatic stuff, but it seems to work.

It doesn't do the error messages yet. Scheme code for list manipulation is so elegant that it's kind of a shame to make clunky versions just to customize the error messages. But if I don't then this interpreter won't conform to the test suite (as it exists as of this writing.)

I like Scheme. It seems like an excellent target language for compiling Joy code, which can then, of course, be compiled to C and thence to machine code. I don't know why I didn't try it sooner.

Build

Build with make to generate a joy binary.

The defs.txt file is converted into a defs.scm Scheme source file by a little utility script generate_defs.scm, and then that is included in the main joy.scm compilation using the -prologue option of the csc Chicken Scheme compiler. It's a little clunky, but it seems to work. Definitions are stored as string literals and converted to Joy expressions during start up of the compiled binary. It would be nice to push the conversion and even the entry into the hashtable into compile time.