[slime-devel] How to support a new interpreter?

Helmut Eller heller at common-lisp.net
Thu Jul 23 11:07:07 UTC 2009


* Elena Garrulo [2009-07-23 11:35+0200] writes:

> Hello,
>
> how would you add to Slime support for? another interpreter? AFAIK, that
> means just writing a dedicated Swank module.

Yep, that's mostly right.  Depending on the language you might also want
to write some ELisp code to figure out the correct module for a buffer
and things like that.

> By looking at Slime48, the
> module to support Scheme48 in Slime, there is quite a bit of code
> involved.

If you want to support all features it's going to take a lot of code,
but at the beginning it only needs the protocol encoding and decoding
and basically a way to call eval in the interpreter.  That's almost enough
to bring up the Slime REPL (without I/O redirection).

In the contrib directory are some less developed backends.  Look at
those for simpler examples.

> Any directions about the required interface?

Depends where you want to go.  The simplest Swank server only needs to
handle the swank:interactive-eval and swank:listener-eval events.

For M-. your interpreter needs to have good source-location tracking and
doubly so if the language has macros.  If your interpreter cannot tell
you where a in file a function was defined your out of luck.

Arglist display is also something that the interpreter must support.

C-c C-c usually requires special tricks because you need to tell the
compiler that the source comes from the middle of a buffer.

For the debugger your interpreter more-or-less has to follow the CL
model where the debugger runs "on-top" of the error, i.e. the stack must
be alive.  It's quite a miracle how the Clojure people managed to adapt
the JVM exception model to Slime's expectations.  Again, the interpreter
need good source-location tracking for the frame-source-location
command.

Interrupts will mostly likely be a challenge.

The inspector is probably not very demanding.

If your interpreter supports all that, than it probably already has a
good IDE :-)

Helmut.





More information about the slime-devel mailing list