If you remember the last capharnaüm, I was talking about working on an Scheme interpreter written in C# for a course this semester. Now that this semester is over, I felt just like it was about time to unveil it to the world.
First of all : it's a prototype. That means it can probably kill kitties among other possibilities.
As of today I think we did it. Our interpreter is already able to do basic Scheme. For the moment, defines (both with constants and lambdas) and most basic standard functions/operators on atoms and list are there.
Following are some snippets that work perfectly fine :
(display (+ (* 2 (* 2 10)) 2)) > 42 (define foo "bar") (define bar "foo") (display (string-append bar foo)) > foobar (define foo (list 1 2 3)) (display (car (reverse foo))) > 3 (define fact (lambda (n) (if (= n 0) 1 (* n (fact (- n 1)))))) (display (fact 4)) > 24
The cool part is that it works very well with Mono (well it was more getting DLR and Irony to work with Mono in the first place). However, we added some specific extensions which allows to consume CLI library's methods, making it useful for a simple glue language.
In it's current state, it's a simple wrapper around some reflection code which makes possible simple thing like
(display (call "System.Environment" "MachineName")) > phoenix
But it would be simple to extend that to include instantiation of .NET object.
Ultimately this interpreter could be used in a variety of scenarios like application scripting, Silverlight/Moonlight logic code or simply for the joy of recoding the universe.
In addition, the architecture is based on a pipeline pattern where each part of the interpretation process is split among several components interacting together with event dispatch. With this approach it is super easy to customize the interpreter to your will. It also improves the testability of each part of the interpreter though the test suite is rather poor (very poor in fact) at the moment.
Oh, before I forget the most important, we nicknamed our interpreter "Béchamel" as the French sauce. Bonus point for the one who is able to mix the sound of the word as we did in order to make "Scheme" appears.