25

Are there any open source Lisp compilers suitable for real-time embedded applications? I.e. with incremental garbage collection, customisable memory handling, small footprint, etc.

Edit:

To clarify, by "compiler" I meant native code, not bytecode interpreter (though the suggested interpreting implementations for microcontrollers are interesting for being a lot smaller than what I thought possible!).

absence
  • 821
  • 1
  • 8
  • 13
  • 1
    I've had success running a stop-the-world garbage collector at the end of every PLC cycle, on a very small platform (64kb of combined code and data space). In any realtime system, there is a concept of a control/processing cycle, and you can run the collector each cycle - whether a full collection, or an incremental one. – Kuba hasn't forgotten Monica Jan 03 '14 at 01:39
  • A crazy and non-practical, but fun stuff which I've done: Let's Run Lisp on a Microcontroller: http://dmitryfrank.com/articles/lisp_on_mcu – Dmitry Frank Jul 25 '16 at 21:21

3 Answers3

19

Take a look at Picobit and the code, which is a Scheme for microcontrollers. There is also tinyscheme, but I don't know how suitable it is for embedding into smaller processors.

andersoj
  • 22,406
  • 7
  • 62
  • 73
14

There are some implementations that compile to C code, e.g. ECL (Embeddable Common Lisp). There is also a very recent library that compiles a subset of Common Lisp to a subset of C++ for the Arduino.

You mentioned "real-time" so nonchalantly, but getting real-time with garbage collection is not trivial. There do exist real-time garbage collectors, but I am not aware of any Lisp implementations using them yet.

Svante
  • 50,694
  • 11
  • 78
  • 122
  • 3
    By "real-time" I don't mean something something so timing sensitive as to need concurrent lock-free garbage collection, but the possibility to configure how often and for how long an incremental garbage collector is allowed to execute, or ideally be able to call it manually where I know the code will be waiting anyway. In short, something more predictable than halting the program at random for unspecified amounts of time. :) – absence Apr 01 '11 at 08:47
7

There is also Hedgehog Lisp from Oliotalo, licensed under LGPLv2.1, with standard library licensed under BSD.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
Chris Perkins
  • 799
  • 4
  • 8