Scheme implementation comparison table
Looking from the outside into the Scheme world

Abstract:

Table of Contents

Comparison between Scheme implementations

This guide was written by someone looking from the outside in, so, without much experience. Therefore, inconsistencies an important omissions may take place. Please, refer to the footnotes as they will include more information and explanations.

The motivation for doing this comparison chart is to select an Scheme implementation with which an Ada/GNAT bootstrapping compiler could be created. Some of the more important aspects that we are looking for are:

Implementation Type License OS support Arch support1 Scheme Standard Build dependencies Runtime dependencies Can be X-compiled Supports X-compiling TCC support2 Library support3 Full numeric tower Full tail recursion optimisation CPS (Continuation Passing Style) Macro support Define types FFI (Foreign Function Interface) Unicode support Embeddable Runs on RISC-V/Linux Build-project system Notes
Chez Compiler, Interpreter Apache v2 Linux, OSX, Windows, Android4 *x86, arm[6], powerpc, more? R6RS C compiler None? ?? Does not seem like it Yes4                 Seems like it       Needs itself to compile itself -> bootstrap problem
Chibi Scheme VM-Interpreter BSDv3 Linux, *BSD, Solaris, Plan 9, Android, iOS, WASM, OSX, Windows Everything supported by the C compiler? R7RS C compiler, GNU Make recommended None, can use Boehm-GC More or less yes5 - Yes6 R7RS small, some SRFIs Yes Yes Yes syntax-rules, SRFI-46, low-level hygienic with syntactic-closures interface Yes:, SRFI-9, SRFI-99 Yes Yes Yes, goal of the implementation   No  
Chicken 5 Compiler7, Interpreter BSDv3 Linux, *BSD, Solaris, Hurd, Haiku, Android, Windows, OSX, more? Everything supported by the C compiler? R5RS, R7RS8 C compiler9, GNU Make None10 Yes Yes Yes   Yes Yes Yes syntax-rules, implicit and explicit renaming macro transformers SRFI-9 (built-in), SRFI-99 (egg). Yes11 Yes No/Yes12 Using -embedded can create .so Yes Yes Has some autogenerated Scheme files
Cyclone Compiler7, Interpreter MIT Linux, FreeBSD, OSX, Windows Know to run on *x86, and arm[7-8] R7RS C compiler, GNU Make, libtommath, concurrencykit ConcurrencyKit ?? Maybe with the generated C code   R7RS large               No, can create .so?     Requires and has a bootstrap
Embedded CL Compiler7, Interpreter LGPLv2 Linux, *BSD, Solaris, Android, Windows, OSX x86*, sparc, arm[6-8], alpha, powerpc Comon Lisp ANSI X3J12 C compiler, GNU Make, libatomicops13, Boehm-GC (autotools) None if built-in Yes Yes No, requires C++ (gc) Lisp               Yes Yes Yes, ASDF  
Gambit Compiler7-Translator, Interpreter Apache v2 and LGPLv2.1 Linux, *BSDs, OSX, Windows, JavaScript, iOS, NintendoDS, FPGAs… Everything supported by the C compiler? R4RS, R5RS, R7RS C compiler, GNU Make, (autotools) None ??/Likely Yes Yes CC=tcc                 Can create .so Yes    
Gauche Interpreter BSDv3 Unix-like, Android Everything supported by the C compiler…? R7RS C compiler, GNU Make, (autotools) (libiconv?, Mbed TLS, pthreads)14 None ??/Likely - No, requires C++ (gc)                       It is still not v1.0, but should be there closely
GNU Guile 3 VM-Interpreter, JIT GPLv3, Library LGPLv3 Linux, *BSD, Solaris, Hurd, Windows, OSX Everything supported by the C compiler? R5RS, R6RS, R7RS C compiler, GNU Make, pkg-config, runtime dependencies GMP, libFFI, Boehm-GC, libltdl, libunistring Yes - No               Yes? Yes, official GNU scripting lang   No15 Fully bootstrapped and reproducible
Loko Scheme Compiler EUPL-1.2 Linux, NetBSD, Bare-metal x8664 x8664 R6RS, R7RS C compiler, GNU Make, Akku, see Notes None Yes Yes16                         Requires bootstrap from another Scheme compiler…
Racket17, 18 VM-Interpreter, Wierd compiler MIT and Apache v2, Runtime LGPLv3 Linux, FreeBSD, OSX, Windows Mostly everything Everything? C compiler, GNU Make, libffi None? Yes Yes19   Huge             Yes No   Yes? Biggest Scheme implementation, it is basically its own language
S7 Interpreter 0-clause-BSD (simpler ISC) LibC Everything supported by the C compiler? R5RS20, R7RS C compiler None Yes - Yes21   Yes/Mostly22 Yes Yes Low-level: CL-style define-macro SRFI-9, SRFI-99 and setters23 Yes Yes/Fully manual24 Meant to, main design Yes25 No Extremely minimal (once .c and one .h file). Modelled after Guile 1.8
SCM VM-Interpreter, Compiler7 LGPLv3 Amiga, Atari, Linux, OSX, MS-DOS, Windows, OS/2, VMS, *NIX Everything supported by the C compiler R5RS C compiler, GNU Make, SLIB26, (autotools) None Yes Maybe with the generated C code No, compiler errors R5RS plus SLIB               Yes   No  
STklos VM-Interpreter GPLv2 Linux, OSX, Windows, Android (used to work in many others) Everything supported by the C compiler R7RS C compiler, GNU Make, Bohem-GC?, GMPLite?, PCRE?, FFI?, pthreads? (autotools) <- C++ deps! None, Unlikely - No, requires C++, also27 R7RS               Yes?   Package manager  

Deeper look into selected Scheme implementations

These implementations were chosen because they can be comiled by TCC and they seem to compile to a large number of targets.

Implementation Type License Arch support Scheme Standart Library support, SRFIs3 SLOC Requires pregenerated files Weight (RISC-V) Drawbacks Advantages Comments
Chibi Scheme VM-Interpreter BSDv3 Needs more checking R7RS Quite a few28 ~85_ 00029 ?? 237KB5, 1.2MB libchibi.so Cross-compiling is not that straight forward Great license for reusability  
Chicken 5 Compiler, Interpreter BSDv3 Everything supported by the C compiler and LibC R5RS, R7RS Quite a few30 ~620_ 00031 Yes, some Scheme files need to be generated by a previous version 2.4MB32 Requires pregenerated Scheme files, requires GNU Make Great license for reusability  
Gambit Compiler, Interpreter Apache v2, LGPLv2.1 Needs more checking R4RS, R5RS, R7RS Quite a few33 ~1_ 700_ 00034 Requires autotools to generate build scripts   Requires autotools, GNU Make Potentially one of the most complete and performat implementations Check which which parts of the library are under LGPL.
S7 VM-Interpreter 0-BSD Everything supported by the C compiler and LibC R5RS, partial R7RS Basic35 82_ 60536 No. 2.7MB37, 3.5MB static25 Compiling to RISC-V staticly is not so simple38. Reduced library support Smallest implementation by far. Extremely easy to compile. Great license for reusability  

Things that could also be interesting

  • Silex: a lexer generator for R5RS/R7RS implementations. See Github.

Footnotes:

1

A lot of the information presented has been taken by the package support in Debian Sid as of <2022-04-28 Do>.

2

TCC is the Tiny C compiler. This is an important compiler since it is used in the first stages of the Guile/World bootstrapping system. For more information see Live-bootstrap.

3

There is this wonderful page that lists all SRFIs and known implementations that supports them.

5

Compiled with default flags: -O3 -g3, dynamicly. JUST THE CHIBI EXECUTABLE! Cannot cross-compile cleanly directly as the libraries need to be built by the executable, which does not run natively. In order to fix this, we follow a two step compilation process, see this procedure.

6

Some tests fail, they are mostly related to mathematical operations having the wrong sign.

7

Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it.

8

R7RS support is added by explicitly including the R7RS egg (Chicken jargon for extension).

9

It is known to work with the Tiny C Compiler. It would not surprise me if it worked with other "small" compilers.

10

The dependence on LibC is said to be small, which means it could run on a customised LibC.

11

Requires the probably non-portable (chicken type) import.

12

The compiler, as of <2022-05-15 So> does not support UTF-8. However, a major rewrite is taking place that will add it. The UTF-8 egg is what currently provides support.

13

I can build its own distribution of the library, but TCC errors out with

make[4]: Verzeichnis „/home/fernando/Builds/ecl-lisp/ecl/build/atomic/src“ wird betreten
source='/home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src/atomic_ops.c' object='atomic_ops.lo' libtool=yes \
DEPDIR=.deps depmode=tcc /bin/sh /home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/depcomp \
/bin/sh ../libtool  --tag=CC   --mode=compile tcc         -fPIC -DHAVE_CONFIG_H   -I../src -I/home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src  -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -fPIC -D_THREAD_SAFE  -c -o atomic_ops.lo /home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src/atomic_ops.c
libtool: compile:  tcc -fPIC -DHAVE_CONFIG_H -I../src -I/home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -fPIC -D_THREAD_SAFE -c /home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src/atomic_ops.c -MD -MF .deps/atomic_ops.TPlo  -fPIC -DPIC -o atomic_ops.o
/home/fernando/Builds/ecl-lisp/ecl/src/bdwgc/libatomic_ops/src/atomic_ops.c:104: error: ';' expected (got "AO_locks")
make[4]: *** [Makefile:612: atomic_ops.lo] Fehler 1
14

Can be turned off.

15

There is the package hall that does it however.

17

Minimal variant.

18

It uses Chez Scheme at its core.

20

R5RS differences.

21

touch mus-config.h && tcc -c s7.c -I. && tcc -o repl repl.c s7.o -lm -I. && ./repl May require a patch to enable/force WITHGCC.

22

For multiprecision arithmetic, GMP, MPFR, MPC are needed…

23

setters are likely to not be portable.

24

From this mailing list discussion, it seem it does support it but only when entered raw… So a very rudimentary way.

25

Compile with $CC s7.c -o s7-riscv -DWITH_MAIN -static -lm

27

Also

tcc -DHAVE_CONFIG_H -I. -I. -I./../gc/include -I../gc/include `./get-atomic-ops-flags.sh .. .. --cflags`   -g -Wall -Wextra -Wno-unused-label -fPIC  -c box.c
In file included from box.c:35:
In file included from gauche.h:124:
In file included from ./gauche/float.h:43:
In file included from /usr/include/complex.h:110:
/usr/include/bits/cmathcalls.h:55: error: ';' expected (got "cacos")
make[1]: *** [Makefile:17: box.o] Fehler 1
28

Chibi has a List of supported modules. It has standard SRFIs and Chibi specific ones.

29

Output from cloc. Cloned from git early may 2022.

cloc . --exclude-dir=benchmarks,build-lib,contrib,data,js,examples,doc,tests,tools
     594 text files.
     561 unique files.                                          
      39 files ignored.

github.com/AlDanial/cloc v 1.92  T=1.00 s (560.0 files/s, 106811.8 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Scheme                          494           8187           7951          58099
C                                46           1806            653          24629
C/C++ Header                     11            540            373           3357
make                              1             86             21            427
CMake                             1            113             65            424
Markdown                          3             48              0            104
YAML                              3              9              0             71
Bourne Again Shell                1              2              2             26
Bourne Shell                      1              1              0              4
--------------------------------------------------------------------------------
SUM:                            561          10792           9065          87141
--------------------------------------------------------------------------------
30

Chicken maintains a somewhat outdated (as of <2022-05-15 So>) list of supported SRFIs.

31

Output from cloc. Version 5.3.0

cloc . --exclude-dir=manual-html,tests,scripts
     244 text files.
     208 unique files.                                          
      41 files ignored.

github.com/AlDanial/cloc v 1.92  T=4.20 s (49.5 files/s, 178924.0 lines/s)
-----------------------------------------------------------------------------------
Language                         files          blank        comment           code
-----------------------------------------------------------------------------------
C                                   90          25984          92662         577108
Scheme                             109           4697           4309          41229
C/C++ Header                         1            472            188           2930
Tcl/Tk                               1            419             60           1446
Bourne Shell                         2              7             32             41
make                                 2              5             29             27
R                                    1              3              0             10
DOS Batch                            1              0              0              2
Windows Resource File                1              1              1              1
-----------------------------------------------------------------------------------
SUM:                               208          31588          97281         622794
-----------------------------------------------------------------------------------
32

Compiled dynamicly, chicken executable, the csi executable weights 183 KB. In order to cross-compile Chicken, we follow this guide.

33

The documentation entry is quite outdated as of <2022-05-15 So>. However, Gambit has support for a nice number of SRFIs and can use package managers as documented in the link of the previous sentence.

34

Output from cloc. Version 4.9.4

cloc . --exclude-dir=bench,bin,contrib,doc,examples,githooks,misc,prebuilt,tests
     739 text files.
     707 unique files.                                          
      51 files ignored.

github.com/AlDanial/cloc v 1.92  T=11.10 s (63.7 files/s, 166709.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               69          22583           3802        1464490
Scheme                         484          34913          18820         231427
Bourne Shell                    10           2927           2172          17574
C/C++ Header                    33           3500           1407          15329
Pascal                           2              2          10432           9184
m4                               1            767              0           3063
make                            83            921            123           2984
C++                             11            319            206           1733
Qt                               5              1              0           1608
YAML                             2             56             21            217
Smalltalk                        1             27             25            194
Markdown                         2             48              0             64
JavaScript                       3             21              6             39
Dockerfile                       1              0              0              6
-------------------------------------------------------------------------------
SUM:                           707          66085          37014        1747912
-------------------------------------------------------------------------------
35

S7 by default is a small language. However, it does support some of the more important extensions and it could use some external SRFIs to expand its library.

36

Output from cloc. Core implementation is s7.c s7.h. Cloned from git early may 2022.

cloc s7.c s7.h 
       2 text files.
       2 unique files.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.92  T=0.85 s (2.4 files/s, 113773.1 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                                1           8990           3625          82605
C/C++ Header                     1            137            584            509
-------------------------------------------------------------------------------
SUM:                             2           9127           4209          83114
-------------------------------------------------------------------------------
cloc *.scm
      23 text files.
      23 unique files.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.92  T=1.14 s (20.2 files/s, 130341.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Scheme                          23          12549           5078         131062
-------------------------------------------------------------------------------
SUM:                            23          12549           5078         131062
-------------------------------------------------------------------------------
37

REPL binary compiled with GCC for RISC-V, dynamic linking to LibC.

38

Compiling staticly does not work out of the box. It needs to then run repl libc.scm which generates a libc_s7.c file and tries compiling it to a libc_s7.so file which it then loads. However, in a embedded RISC-V we do not have a working C compiler… Compiling it dynamicly does not seem to work out of the box either. Need to ask the authors.

Date: 2022-04-30 Sa 00:00

Author: Fernando Oleo Blanco

Email: irvise _at_ irvise.xyz

Created: 2022-05-16 Mo 20:53

Emacs 27.1 (Org mode 9.4.4)

Validate