views:

539

answers:

6

I'm looking at ways to embed Lisp or Scheme in a C program, but I want to do so without growing the program size considerably. It doesn't need to be fast, or support lots of features. (Though macros would be nice.) This is not a math-intensive application.

Please list the smallest embeddable interpreter for a Lisp-like language you know of. Alternatively, list compilers which generate very small embeddable and self-contained code.

+9  A: 

Hedgehog

Hedgehog is a very concise implementation of a Lisp-like language for low-end and embedded devices. It consists of a compiler and a byte code interpreter. The byte code interpreter is written in standard conforming C, is efficient and easily portable, and can be compiled to a very small executable of only some 20 kilobytes in the smallest configuration for the Intel x86 architecture.

The Hedgehog Lisp dialect has proper support for local and lambda functions, lexical scoping, variable argument functions, garbage collection, exceptions, macros, and over a hundred predefined functions or special forms. The built-in types are lists, symbols, strings, 32-bit integers, AVL-trees, and tuples up to 16 elements wide. Proper 32-bit wide integers are necessary for various bit-level operations in embedded systems.

Hedgehog is free software. The compiler and interpreter are under the GNU Lesser General Public License (LGPL) and the Hedgehog standard library is under a license similar to the BSD one. The free version works on Linux and should be trivially portable to any POSIX system.

http://hedgehog.oliotalo.fi/

Robert Harvey
+5  A: 

You may try ECL (Embeddable Common Lisp). ECL is a full Common Lisp that is easily embeddable into C programs and that generates small binaries. It's not as fast as SBCL, though.

dmitry_vk
+3  A: 

PicoLisp. Actively developed and "used since 1988 in actual application development, research and production."

http://www.software-lab.de/down.html

z5h
+3  A: 

GNU Guile is an implementation of Scheme expressly for the purpose of embedding in other programs.

mch
+1  A: 

Try SIOD.

lhf
A: 

There is also a Lisp variant called NewLisp. It is about 200k in size (slight variation depending on the platform) and can be embedded. It supports Macros and runs on all major platforms. The license is GPL.

user8472
Why the downvote?
Thorbjørn Ravn Andersen