In the last months, I was active written Lisp interpreters. Since the eighties, I like to write such interpreters. One of my preferred exercises when I study a new programming language, is to write a Lisp interpreter.
In 2008, I published a code written in C#, AjLisp:
At mid of 2009, I started to research Clojure. Then, I decide to explore the news ideas of that language, reimplemeting it in C# (original Clojure is written in Java, but there is a version written in .NET, that compiles to .NET using Dynamic Language Runtime). It’s only an interpreter (I should study more about DLR or .NET compilation, to write down a compiler; and about how to do it… ;-). The result is work in progress, named AjSharpure (I named it AjClojure, but I had to change the name). You can see the code, under development:
Initially, my idea was to port “one-to-one” Clojure java code, but I realized that its code is not easily read, no test on code, no spefication about the behavior of dozens of methods, so I stopped, and rethinked my way. I took courage, forget my initial code, and start bottom-up, full TDD, implementing piece by piece, only trying to follow the external behavior of the language, instead of its internal implementation.
I stopped AjSharpure development, to study more about variables in Clojure, Shared Transactional Memory, and other topics. Then I back to 2008 version of AjLisp. I write a new version in 2009, with major refactoring of the previous one. Now, it can manage native objects and values. The trunk is at:
There is no “plain vanilla” Lisp, and there are TWO main dialects: Common Lisp and Scheme. I don’t like Common Lisp (I should write a post about my reasons), so, in order to know more about Clojure and current Lisp development, I started AjScheme, an interpreter that implements most of the Scheme reference (I give up to implement macros as in Scheme, I back to mlambdas and alike):
AjLisp was born following an old Christian Queinnec book (I didn’t find the code of that book in the web). He wrote a Lisp interpreter in Lisp itself. Queinnec use a simplified Lisp. But I want to study more about the minimal needed kernel. So, now I’m working on AjCoreLisp:
It has no parser or lexer. The idea is implement an minimal interpreter using AjCoreLisp as the basis: the result is named MinimaLisp, and it’s included in the trunk. I’m implementing few primitives, and I’m trying to write the rest of the common forms as functions or macros. A geeky decision: implement backspace macro expansion as a macro! See code at:
Once I have AjCoreLisp stabilized, I will refactor AjLisp, AjScheme, to use a more slim kernel, but re-implementing the most used forms as primitives. I should measure the impact of using most used forms as macro. I’m confident on the successful of changes, since all is backed by a battery of test (TDD and tests save my day many times, when I refactored much of this code base).
I will write detailed posts about these different interpreters, variations over a leit motiv: the beautiful ideas of Lisp language.