A Lisp Interpreter for Squeak

By: on July 15, 2005

This is a simple-minded (and slightly weird) Lisp interpreter for Squeak Smalltalk. It doesn’t have a REPL under Morphic, but I’ve hacked on it to provide a minimal Morphic UI.

It got me thinking about Lisp Machines again. What if the existing Squeak infrastructure could be exploited to build a Scheme Machine? The minimal addition required to the Squeak VM would be a tail-call opcode. Once tail calls are possible, a compiler could be written to take Scheme code to Squeak bytecode. A full module system could be implemented fairly easily, thanks to Smalltalk’s non-separation of compile-time and runtime. The mapping between Smalltalk constructs and Scheme Machine constructs might be:

Scheme Machine Smalltalk
Module Class
Module instantiations Instances
Global variables Probably wouldn’t be implemented — you’d use module-local variables instead, just like MzScheme’s module system
Module-local functions Instance methods
Module-local variables Instance variables

Integration with the debugger might be tricky. Many system utilities expect to be able to decompile bytecode into Smalltalk; a major refactoring might be needed for multi-language integration within Squeak. One would have to tag each method with the decompiler to use, update each UI widget to display these annotations etc.

FacebookTwitterGoogle+

Comment

  1. Frank Shearar says:

    Funny I should read this now. I’ve been working with ometa a bit, and it almost turns squeak’s code browser into an IDE for ometa.

    It made me wonder if one couldn’t turn Squeak into an IDE for, say, Common Lisp. Really, Squeak’s tools are so awesome that they make hacking in emacs seem unbearable, even if it is hacking CL.

Post a comment

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>