MGCLisp

Coming on the heels of MGCBasic is MGCLisp, the next adventure of my compiler writing expedition. MGCLisp is a simple S-expressions interpreter, and still very much a work in progress. Many lessons were learned over the course of developing MGCBasic and were put to good use in the development of MGCLisp.

Because of the widely differing syntax of BASIC and Lisp, the only code from that project that was reusable was the main Lexing logic and the symbol table code.

One thing I did differently this time around was wrap the token stream in an iterator class, which has worked surprisingly well, and done a lot to increase the readability of the code.

The recursive nature of S expressions meant the eval() method was an absolute pleasure to write. But enough of the yakity yak, lets see MGCLisp in action!

Evaluating Algebraic Expressions
Using relative operators
let returns the value of the *last* value of a multi assignment expression.

More to come soon!

MGCLisp is available on my Github! http://github.com/maxgoren/mgclisp


Leave A Comment