April 08, 2005

Embedding Scheme and Lisp in Java Permalink

I conducted a little survey on the available implementations of Scheme and Common Lisp in Java. The main purpose of using a Java implementation is the ability to embed a Scheme/Lisp program into a Java environment, and thus running it within a JVM, sharing and accessing Java object and accessing Java libraries. Furthermore, I'm a big fan of domain-specific scripting languages as a mean to provide extension points to complex applications, and Lisp has a long and successful story as a scripting language (Emacs, AutoCAD, and others applications).

Some factors to take into consideration while choosing a Java implementation are:
  • The license. I took into consideration only open source, OSI-compatible licenses. You may want a LGPL-like license if you are going to embed the language into a commercial application;
  • Scheme or Lisp. I agree with Paul Graham that you may prefer Scheme if you want a cleaner, more polished language, while you need Common Lisp if you want to use lisp-like macros.
In my opinion, some viable choices are:
  • Armed-Bear Common Lisp. An almost fully compliant Common Lisp interpreter and compiler, with a complete support for macros, together with an emacs-like environment. Outstanding, but with a GPL license. The compiler generates java bytecode on the fly.
  • Jatha Lisp. A LGPL Lisp interpreter, specifically designed to be embedded. It implements the full Common Lisp specification, with basic support for macros.
  • Kawa. An embeddable Scheme interpreter and compiler, almost compliant with the R5RS specification. Choice of GPL license, or a LGPL-like business-friendly license.
  • SISC. A embeddable, fully R5RS compliant Scheme interpreter, licensed as MPL or GPL. The authors maintain it "handily outperforms all existing JVM interpreters". It is a very well documented project. SISCweb is a framework for writing web applications based on SISC.
Updated, 10 apr 2005, to correct the information about SISC licensing terms, which was wrong.

Updated, 18 apr 2005: two interesting introductive tutorials on Scheme-Style Macros: Patterns and Lexical Scope and Composable and Compilable Macros.

2 Comments:

Scott Miller said...

SISC is actually dual licensed under the MPL and GPL, not the LGPL. Also, Scheme has macros, hygienic ones even. And nearly all support Common Lisp style macros.

Finally, SISC does outperform all JVM based Scheme interpreters, and is within 30% of compiled Kawa these days.

April 17, 2005 10:18 PM  
Francesco Bellomi said...

Scott, thanks for your corrections and comments. I'll update the entry, in order to give a fair account of SISC.

April 17, 2005 10:20 PM  

Post a Comment

<< Home