Scheme from Scratch - Royal Scheme v0.1 - Integers
It took a while but the plan is back on track. Royal Scheme is a go.
I’ve been picking away at the project at a leisurely pace trying to determine exactly what it will be. Blog articles seem like a great way to keep folks informed about the state of development. Hopefully some folks will want to follow along creating their own implementations again like they did with Bootstrap Scheme. It was a whole bunch of fun.
I think a book format would be a better format for truly documenting the iterative development of a real Scheme interpreter that is implemented in C. I still haven’t found that book and if I was taking a university course then I’d want to take the course that has that book as its primary text. So a lot of what Royal Scheme development will be about is ensuring the order of introducing features is just right and that the concepts underlying the implementation are explained in code comments and in a book. It is a lofty goal. We’ll see how it goes. I’m hoping for feedback from you.
Just as Bootstrap Scheme started with integers, so does Royal Scheme.
$ ./scm Welcome to Royal Scheme. Ctrl-c to exit. > 123 123 > -123 -123 > +007 7 > ^C $
I’ve put the code on github. I’m new to git and github which adds a bit more flavor to the project. You can browse the code at the following address
and I created a branch specifically for this integers-only version
You can get the code with the following command
$ git clone https://github.com/petermichaux/royal-scheme.git
You should be able to just run
make and then the above REPL session example should work.
I’m hoping you will scrutinize the code and really give me grief that I’ve done something silly, stupid, overly complex, have a trailing space on a line, haven’t written a comment where a comment would be helpful, etc. I’m particularly interested in what you think of checking the return value of
repl. It doesn’t feel right quite to me. Also the overflow checking in
scm_read_number happens each iteration which is not as efficient as it possibly could be.
By the way, registration for the Scheme 2011 Workshop will open in August. I’m planning on going and hoping to talk with some people there about Royal Scheme.
Previous article: Introduction
Have something to write? Comment on this article.