Armed Bear Lisp

Armed Bear Common Lisp (aka ABCL) is a Common Lisp implementation that runs on a Java Virtual Machine. It includes a compiler to Java bytecodes, and allows access to Java libraries from Common Lisp.

Armed Bear Common Lisp is distributed under the GNU GPL. It was originally created as a component of the Armed Bear J editor, where it serves as an extension language (rather like Emacs Lisp for Emacs), but lately (2008Q3), more development effort has been going into developing it as a standalone Lisp implementation.

One may download a pre-built JAR archive, which may be run as

   java -jar abcl-0.0.11.jar

to invoke the Armedbear REPL. Type "(quit) or :exit" to exit.

Forms in the file $HOME/.abclrc will be executed on startup, if it exists.

ABCL runs quite well with SLIME, which allows you to run ABCL from within Emacs.

Portability

Armed Bear Common Lisp requires Java 1.5 or later. It runs much better with a JVM that features a JIT, such as (for Linux/x86) the IBM or Sun virtual machines. It also runs, though very slowly, with the GNU gij virtual machine, as of version 3.3, and (with some exceptions) with SableVM as of version 1.0.9. It is also possible to use recent versions of the GNU Java compiler gcj to produce a standalone native executable.

There are a few things to look out for in ABCL:

1. The CLOS implementation is very slow

2. EQL fixnums are not EQ (legal according to ANSI, but unusual)

3. The implementation uses autoloading a lot.

Accessing Java from ABCL

ABCL gives you access to all those methods in the Java runtime environment. This is implemented using the Java Reflection API. To call a static method, use the jstatic function:

(jstatic "gc" "java.lang.System")
(jstatic "getProperty" "java.lang.System" "user.dir")

To obtain a reference to a Java method, call jmethod with the class name, method name, and parameter types:

(jmethod "java.lang.Runtime" "availableProcessors")

To invoke a (non-static) Java method, use jcall with the reference to the method, a reference to the invoked object, and the method arguments:

(jcall (jmethod "java.lang.Runtime" "availableProcessors") (jstatic "getRuntime" "java.lang.Runtime"))

To invoke a constructor, use jconstructor and jnew in place of jmethod and jcall.

(jnew (jconstructor "java.lang.Object"))

There are a fair number of (poorly) documented Java specific Lisp extensions in the JAVA package. Currently, reading the source to 'java.lisp' while experimenting with the REPL is probably the best way to come to an understanding of what is available.

Of common interest is the JAVA:JIMPLEMENTATION-INTERFACE function, which allows one to implement a Java interface in Common Lisp.

Extensions

Alan Ruttenberg's JSS provides a more convenient syntax for calling Java.

Obtaining

This project is now hosted at common-lisp.net http://common-lisp.net/project/armedbear/.

Source distribution

abcl-src-0.0.11.tar.gz

abcl-src-0.0.11.zip

SVN

To obtain the source tree from SVN, the command

 svn checkout svn://common-lisp.net/project/armedbear/svn/trunk/j abcl
will create a directory named 'abcl' with the source tree.

Trac

A Trac instance for ABCL issues has been created on common-lisp.net. Unfortunately, it is read-only to non-members of common-lisp.net. TO submit issues, please post a message to the mailing list noted below.

Mailing List

The ABCL developers are using the SourceForge hosted armedbear-j mailing list to communcate. Unfortunately, you must be subscribed to post.

A more convenient manner to read the mailing list from a web browser without subscribing can be found via the gmane.org NNTP interface for the 'gmane.editors.j.devel' group.


This page is linked from: ABCL   amphipoLISP   features   Gentoo   jss   MacOS X   Peter Graves   Solaris   trivial-sockets   trivial-usocket   usocket  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively