Thun/implementations/scheme-chicken
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
..
.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
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 A start on error reporting. 2023-10-20 11:42:50 -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.