Scheme implementation comparison table
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:
- Early compilation following this bootstrapping procedure.
- Small but powerful implementation.
- Reproducible.
- Auditable.
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 | Yes5 | 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 yes6 | - | Yes7 | 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 | Compiler8, Interpreter | BSDv3 | Linux, *BSD, Solaris, Hurd, Haiku, Android, Windows, OSX, more? | Everything supported by the C compiler? | R5RS, R7RS9 | C compiler10, GNU Make | None11 | Yes | Yes | Yes | Yes | Yes | Yes | syntax-rules , implicit and explicit renaming macro transformers | SRFI-9 (built-in), SRFI-99 (egg). Yes12 | Yes | No/Yes13 | Using -embedded can create .so | Yes | Yes | Has some autogenerated Scheme files | |
Cyclone | Compiler14, 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 | ||||||||||
Gambit | Compiler15-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 | Yes | Yes | Yes CC=tcc | Can create .so | Yes | ||||||||||
Gauche | VM-Interpreter | BSDv3 | Unix-like, Android | Everything supported by the C compiler…? | R7RS | C compiler, GNU Make, (autotools) (libiconv?, Mbed TLS, pthreads)16 | None | ??/Likely | - | No, requires C++ (gc) | It is still not v1.0, but should be there closely | |||||||||||
Gerbil | Compiler, Interpreter | Apache v2 and LGPLv2.1 | Gambit’s support | Gambit’s support | R5RS, R7RS | Gambit, libcrypto | None | Likely | ?? | - | Yes | |||||||||||
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 | No17 | Fully bootstrapped and reproducible. LOC count in18 | ||||||||
Loko Scheme | Compiler | EUPL-1.2 | Linux, NetBSD, Bare-metal x86_64 | x86_64 | R6RS, R7RS | C compiler, GNU Make, Akku, see Notes | None | Yes | Yes19 | Requires bootstrap from another Scheme compiler… | ||||||||||||
Maru | TODO | |||||||||||||||||||||
Ol | VM-Interpreter, Compiler20 | MIT and LGPLv3 | LibC | Everything supported by the C compiler? | R7RS subset | C compiler | None | Yes | Yes? | |||||||||||||
Owl | VM-Interpreter | MIT | LibC | Everything supported by the C compiler? | R7RS subset | C compiler | None | Unlikely | Unlikely | Yes | Basic | No | Yes? | Yes | No? | Yes21 | No | Very small implementation in C/Scheme | ||||
Racket2223 | VM-Interpreter, Wierd compiler | MIT and Apache v2, Runtime LGPLv3 | Linux, FreeBSD, OSX, Windows | Mostly everything | Everything? | C compiler, GNU Make, libffi | None? | Yes | Yes24 | Huge | Yes | No | Yes? | Biggest Scheme implementation, it is basically its own language | ||||||||
Ribbit | VM-Interpreter | BSDv3 | Any target language | Any target language | Subset of Scheme | None | Likely | No | ||||||||||||||
S7 | Interpreter | 0-clause-BSD (simpler ISC) | LibC | Everything supported by the C compiler? | R5RS25, R7RS | C compiler | None | Yes | - | Yes26 | Yes/Mostly27 | Yes | Yes | Low-level: CL-style define-macro | SRFI-9, SRFI-99 and setters 28 | Yes | Yes/Fully manual29 | Meant to, main design | Yes30 | No | Extremely minimal (once .c and one .h file). Modelled after Guile 1.8 | |
s9fes | TODO | |||||||||||||||||||||
SCM | VM-Interpreter, Compiler31 | LGPLv3 | Amiga, Atari, Linux, OSX, MS-DOS, Windows, OS/2, VMS, *NIX | Everything supported by the C compiler | R5RS | C compiler, GNU Make, SLIB32, (autotools) | None | Yes | Maybe with the generated C code | No, compiler errors | R5RS plus SLIB | Yes | No | |||||||||
sharpF | Compiler | BSDv3 | LibC? | Everything supported by the C compiler | R5RS/R7RS | C compiler | C compiler | Yes | - | Yes | R5RS | No | Yes | Yes | No? | Much larger than it seems, it stands at ~105kLOC | ||||||
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++, also33 | R7RS | Yes? | Package manager | |||||||||
TR7 | VM-Interpreter | BSD-0 | LibC | Everything supported by the C compiler | R7RS | C compiler | None | Yes | - | Yes | R7RS | Yes | Yes | Yes | In the works | ? | ? | Yes | Yes | Needs work | No | Still fresh. Based on TinyScheme |
TinyScheme | VM-Interpreter | BSDv3 | LibC | Everything supported by the C compiler | R5Rs | C compiler | None | Yes | - | Yes | None | No rationals/complex | No hygienic macros | Yes | Yes | Yes | No | Very small34, but lacks in a few areas… | ||||
TinyScheme.C | TODO | |||||||||||||||||||||
LISP and LISP-like | ||||||||||||||||||||||
BoCL | TODO | |||||||||||||||||||||
Embedded CL | Compiler35, Interpreter | LGPLv2 | Linux, *BSD, Solaris, Android, Windows, OSX | x86, sparc, arm[6-8], alpha, powerpc | Common Lisp ANSI X3J12 | C compiler, GNU Make, libatomic_ops[fn:29], Boehm-GC (autotools) | None if built-in | Yes | Yes | No, requires C++ (gc) | Lisp | Yes | Yes | Yes, ASDF | ||||||||
Easy-ISLisp | Compiler36, Interpreter | BSDv2 | Linux, *BSD, OSX, NIX | Everything supported by the C compiler? | ISLisp | C compiler, ncurses**37 | None (ncurses)38 | Likely | Likely | Yes, patched39 | Yes | Yes | ||||||||||
Femtolisp | TODO | |||||||||||||||||||||
MiniLISP | Interpreter | Public Domain | LibC | Everything supported by the C compiler? | Minimal | C compiler | None | Likely | Yes | None | No | No | No | Basic | No | No | Probably | Likely | No | Minimal implementation under 1kLOC | ||
newLISP | TODO | |||||||||||||||||||||
TinyLisp | TODO | |||||||||||||||||||||
uLisp | TODO | |||||||||||||||||||||
Janet | VM-Interpreter | MIT | TODO | Everything supported by the C complier? | No formal specification | C compiler, Make | None | Yes through Make | - | Yes40 | - | Yes | Yes | Yes | Yes | Yes? | ||||||
Lua and Lua-based | ||||||||||||||||||||||
Lua | VM-Interpreter | MIT | Aix, *BSD, Linux, C89, POSIX, Solaris, OSX, Windows | Everything supported by the C compiler? | Lua, no formal specification | C compiler, Make41 | None | Yes | - | Yes, minor patch | - | +- | ? | ? | No? | ? | Yes | Basic | Yes | Yes | LuaRocks | Not lispy |
Fennel | TODO | MIT | Same as Lua | Everything supported by the C compiler? | No formal specification | |||||||||||||||||
TCL | ||||||||||||||||||||||
TCL | VM-Interpreter | MIT | Everything supported by the C compiler? | TCL | C compiler | None | Yes | - | Yes | TCL | Yes | Yes | Yes | Yes | None? | |||||||
Jim TCL | VM-Interpreter | BSDv2 | Everything supported by the C compiler? | Most of TCL | C compiler, autosetup42 | None | Yes | - | Yes | Some extras | Yes | Yes | Yes | Yes | None? | |||||||
JavaScript | ||||||||||||||||||||||
Jerry Script (JS) | VM-Interpreter | Apache v2 | TODO | ES6/ES2015 at least | None | - | Yes | The build system is complex (CMake, scripts…) but it works | ||||||||||||||
MuJS | VM-Interpreter | ISC | TODO | Everything supported by the C compiler? | ES5 | None | Yes | - | Yes | Yes | ||||||||||||
QuickJS | VM-Interpreter, Compiler | MIT | TODO | Everything supported by the C compiler? | ES2023 | C compiler | C compiler for compilation | Yes | - | Yes | Yes |
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, SRFIs43 | SLOC | Requires pregenerated files | Weight (RISC-V) | Drawbacks | Advantages | Comments |
---|---|---|---|---|---|---|---|---|---|---|---|
Chibi Scheme | VM-Interpreter | BSDv3 | C compiler and LibC | R7RS | Quite a few44 | ~85_00045 | No, with a catch46 | 237KB47, 1.2MB libchibi.so, 1.7MB static48 | Cross-compiling is not that straight forward. Not very performant | Great license for reusability | |
Chicken 5 | Compiler, Interpreter | BSDv3 | C compiler and LibC | R5RS, R7RS | Quite a few49 | ~620_00050 | Yes51 | 2.4MB52 | Requires pregenerated Scheme files, requires GNU Make | Great license for reusability | |
Gambit | Compiler, Interpreter | Apache v2, LGPLv2.1 | C compiler, LibC and common OSs | R4RS, R5RS, R7RS | Quite a few53 | ~1_700_00054 | Yes55 | Requires autotools, GNU Make | Potentially one of the most complete and performat implementations | Check which which parts of the library are under LGPL. | |
Owl | VM-Interpreter | MIT | C compiler, LibC | Subset R7RS | Minimal | ~20_00056 | No | 1.3MB57 | Not a full R7RS implementation. Very slow, has some compile issues. Unmaintained? | Extremely small C core | |
Ribbit | VM-Interpreter | BSDv3 | Subset | None | ~6_50058 | Non Scheme files seem to be pregenerated | Minimal bootstrapping implementation | ||||
S7 | VM-Interpreter | 0-BSD | C compiler and LibC | R5RS, partial R7RS | Basic59 | 82_60560 | No | 2.7MB61, 2.0MB static62 | Compiling to RISC-V staticly is not so simple63. Reduced library support | Smallest implementation by far. Extremely easy to compile. Great license for reusability | |
TR7 | VM-Interpreter | 0-BSD | C compiler and LibC | R7RS | Basic | ~13_60064 | No | 715KB65 | Very fresh and still unfinished. Still has errors while testing in RISC-V | Incredibly small and targets R7RS | Keep an eye on it |
LISPs | |||||||||||
Easy-ISLisp | Compiler, Interpreter | BSDv2 | C compiler and LibC | ISLisp | - | 39_00066 | No | 843KB67 | Defined standard. Can compile to C. Great license for reusability. Very small. | Keep an eye on it | |
Janet | VM-Interpreter | MIT | C compiler and LibC | - | - | 31_70068 | No | ||||
Lua | |||||||||||
Lua | VM-Interpreter | MIT | C compiler, LibC and common OSs | - | - | ~20_00069 | No | 210KB70 | No defined standard | Very small | Worth it compared to Schemes? |
TCL | |||||||||||
Jim TCL | VM-Interpreter | BSDv2 | C compiler, LibC and common OSs | - | - | 41_20071, 21_000 autosetup72 | No? | 1.4MB static73 | TCL is a bit quirky. Jim is not THE standard TCL | TCL is extremely flexible. Core is small. Most tests pass74! | |
JavaScript | |||||||||||
MuJS | VM-Interpreter | ISC | C compiler, libC | ES5 | - | 17_00075 | No | 172KB76, dynamicaly linked | Older JS implementation, still fails a few tests | It is standard JS, one of the easiest, most widely used languages | |
QuickJS | VM-Interpreter, Compiler | ISC | C compiler, libC | ES2023 | - | 87_50077 | No? | 853KB78 |
Things that could also be interesting
Footnotes
Maybe libc_s7.c
could be compiled directly into s7
?
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 |ines/s)
------------------------------------------------------------------|------------
Language files blank comment | code
------------------------------------------------------------------|------------
Scheme 23 12549 5078 | 131062
------------------------------------------------------------------|------------
SUM: 23 12549 5078 | 131062
------------------------------------------------------------------|------------
Footnotes
-
A lot of the information presented has been taken by the package support in Debian Sid as of <2022-04-28 Do>. ↩
-
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. ↩
-
There is this wonderful page that lists all SRFIs and known implementations that supports them. ↩
-
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. ↩ -
Some tests fail, they are mostly related to mathematical operations having the wrong sign. ↩
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
R7RS support is added by explicitly including the R7RS egg (Chicken jargon for extension). ↩
-
It is known to work with the Tiny C Compiler. It would not surprise me if it worked with other “small” compilers. ↩
-
The dependence on LibC is said to be small, which means it could run on a customised LibC. ↩
-
Requires the probably non-portable
(chicken type)
import. ↩ -
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. ↩
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
Can be turned off. ↩
-
LOC count generated from git on <2022-12-10 Sa>
↩fernando@localhost:~/Builds/Guile/guile> cloc . --process=4 --exclude-dir=doc,emacs,examples,bechmark,benchmark-suite,test-suite,gc-benchmarks 1447 text files. 1347 unique files. 101 files ignored. github.com/AlDanial/cloc v 1.92 T=1.15 s (1168.1 files/s, 351669.4 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 490 23763 17250 144168 Scheme 352 12097 22104 93785 C/C++ Header 264 7220 10317 32305 m4 199 1651 1739 25996 make 19 1323 1520 5025 Bourne Shell 12 398 635 2556 Lisp 2 128 35 507 awk 2 76 166 240 diff 4 13 43 171 lex 1 36 13 147 Markdown 1 16 0 41 YAML 1 6 0 32 ------------------------------------------------------------------------------- SUM: 1347 46727 53822 304973 -------------------------------------------------------------------------------
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
Seems to have an issue running tests. A second
make
is required to build it. The error:
↩Running tests/ against bin/vm fasl/bootp.fasl: .....................................................................|............................. FAILED 1c1 < #true --- > #false ERROR: tests/char-ready.sh
-
Minimal variant. ↩
-
It uses Chez Scheme at its core. ↩
-
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 WITH_~GCC~~~ Already fixed <2022-06-25 Sa>. ↩ -
For multiprecision arithmetic, GMP, MPFR, MPC are needed… ↩
-
setters
are likely to not be portable. ↩ -
From this mailing list discussion, it seem it does support it but only when entered raw… So a very rudimentary way. ↩
-
Compiled with
$CC s7.c -o s7-riscv -I. -DWITH_MAIN -DWITH_C_LOADER=0 -static -Os -lm -pthread -Wl,-export-dynamic
and stripped.In order for S7 to be useful with the C library, it needs
libc_s7.so
.libc_s7.so
is generated automatically by S7 when it loadsr7rs.scm
orlibc.scm
. It transpileslibc.scm
to C producinglibc_s7.c
. Then it loadscload.scm
to compile the generatedlibc_s7.c
intolibc_s7.so
.The technique that is theorised but still not successfully used to cross-compile S7 would be:
- Compile S7 natively, for example:
gcc s7.c -o s7 -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic
ortcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -rdynamic -DWITH_C_LOADER
-Wl,-export-dynamic
is needed! Otherwise some symbols, such ass7_f
will not be found and loadinglibc_s7.so
will fail.
- Run
./s7 r7rs.scm
so that S7 generateslibc_s7.c
- Compile S7 with a cross-compiler
riscv32-buildroot-linux-gnu-gcc s7.c -o s7-riscv -DWITH_MAIN -DWITH_C_LOADER=1 -ldl -static -Os -lm -I. -Wl,-export-dynamic
- Cross compile
libc_s7.c
, for exampleriscv32-buildroot-linux-gnu-gcc libc_s7.c -o libc_s7.so -shared -rdynamic -DWITH_MAIN -DWITH_C_LOADER=1 -Os -ldl -lm -I. -pthread -Wl,-export-dynamic
The method described above does not work as symbols are still not found:
↩s7: 22-Jun-2022 load /mnt/s7/libc_s7.so failed: /mnt/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x01;\x01;\x01;") ; (symbol "\x7f;ELF\x01;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ;unbound variable fileno in (fileno stdin) ; (fileno stdin) ; repl.scm, line 207, position: 6849 ; (fileno stdin) ; ((terminal-fd (fileno stdin)) (tab-as-spa... ; ((lambda (hook lst) (when (or (not (proce... ;unbound variable *repl* ; (*repl* 'run) ; ((*repl* 'run)) ; ((lambda (new-size) (unless (= new-size h... ; histsize: 100, histpos: 0 ; histbuf: #("" "" "" "" ...) ;
- Compile S7 natively, for example:
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
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
-
↩tinyscheme-1.42> cloc . 15 text files. 8 unique files. 7 files ignored. github.com/AlDanial/cloc v 1.92 T=0.04 s (197.4 files/s, 165288.6 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 2 576 256 4370 C/C++ Header 4 82 32 568 Scheme 1 96 78 542 make 1 20 39 39 ------------------------------------------------------------------------------- SUM: 8 774 405 5519 -------------------------------------------------------------------------------
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
Requires a C compiler on the host in order to compile Scheme. It basically translates Scheme into C and compiles it. ↩
-
curses
support has been recently made optional. Compile withWITHOUT_CURSES
.Currently it requires↩ncurses
, however, we may be able to easily patch it out, see this issue. -
curses
support has been recently made optional. Compile withWITHOUT_CURSES
.Currently it requires↩ncurses
, however, we may be able to easily patch it out, see this issue. -
The set of patches has been upstreamed.
A set of patches to disable nana and “complex.h” are needed. They are basic and simple.↩ -
JANET_USE_STDATOMIC=1
has to be enabled withinCOMMON_CFLAGS
. The end result would, therefore, be:make CC=tcc COMMON_CFLAGS="-DJANET_USE_STDATOMIC=1 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC"
↩ -
Could easily be taken out ↩
-
Build system included as part of the source code.
↩~/Builds/jim-tcl/jimtcl/autosetup> cloc . 19 text files. 13 unique files. 6 files ignored. github.com/AlDanial/cloc v 1.92 T=0.59 s (22.0 files/s, 51834.1 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 1 3959 3192 15358 Bourne Shell 4 380 1012 4722 Tcl/Tk 8 169 605 1184 ------------------------------------------------------------------------------- SUM: 13 4508 4809 21264 -------------------------------------------------------------------------------
-
There is this wonderful page that lists all SRFIs and known implementations that supports them. ↩
-
Chibi has a List of supported modules. It has standard SRFIs and Chibi specific ones. ↩
-
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 --------------------------------------------------------------------------------
-
If Chibi is being compiled staticly, it needs the `clibs.c` file (which can be generated via `make clibs.c`). This file translates all the hand-written Scheme libraries to C so that it can be compiled statictly using `chibi-ffi`, which is a handwritten utility. If no library support is needed, then this is not required. ↩
-
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. ↩ -
Compiled by building first
make clibs.c
with the local Chibi installation and then compiling withmake -B chibi-scheme-static SEXP_USE_DL=0 CFLAGS="-DSEXP_USE_STATIC_LIBS -DSEXP_USE_STATIC_LIBS_NO_INCLUDE=0 -Os -g0"
. Adding-march=rv32imafd
generates a binary of the same size. Executing the static version requires passing the-q
flag, for example:CHIBI_IGNORE_SYSTEM_PATH=1 CHIBI_MODULE_PATH=lib ./chibi-scheme-static -q tests/r7rs-tests.scm
↩ -
Chicken maintains a somewhat outdated (as of <2022-05-15 So>) list of supported SRFIs. ↩
-
Output from
cloc
. Version 5.3.0. It includes the pregenerated C files for the bootstrap. This means that the handwritten Scheme files and their translation to C are counted. This may seem unfair, but the Scheme files are written by humans, and therefore count, and the C transpilation is needed by the compiler.
↩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 -----------------------------------------------------------------------------------
-
Some files need to be generated by a previous version. See the
Bootstrapping
section from the README. ↩ -
Compiled dynamicly,
chicken
executable, thecsi
executable weights183 KB
. In order to cross-compile Chicken, we follow this guide. ↩ -
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. ↩
-
Output from
cloc
. Version 4.9.4. It includes the pregenerated C files for the bootstrap. This means that the handwritten Scheme files and their translation to C are counted. This may seem unfair, but the Scheme files are written by humans, and therefore count, and the C transpilation is needed by the compiler.
↩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 -------------------------------------------------------------------------------
-
See
make bootstrap
. ↩ -
↩cloc . --exclude-dir=tmp,tests,doc 86 text files. 83 unique files. 5 files ignored. github.com/AlDanial/cloc v 1.92 T=0.11 s (746.7 files/s, 221577.2 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Scheme 78 2921 1831 18070 C 1 60 41 1389 make 1 41 21 135 Markdown 1 25 0 69 sed 1 0 0 18 YAML 1 2 0 6 ------------------------------------------------------------------------------- SUM: 83 3049 1893 19687 -------------------------------------------------------------------------------
-
Compiled with
make CC=gcc CFLAGS="-Os -static"
, not stripped. ↩ -
↩cloc . --exclude-dir=docs,bench --fullpath --not-match-d="/*prebuilt" --exclude-lang=OCaml,Scala,Haskell,Rust,Idris,JavaScript,Java,Python,Go 114 text files. 88 unique files. 37 files ignored. github.com/AlDanial/cloc v 1.92 T=0.12 s (681.6 files/s, 76586.0 lines/s) -------------------------------------------------------------------------------- Language files blank comment code -------------------------------------------------------------------------------- Scheme 44 1028 898 4460 Bourne Shell 10 71 33 724 C 1 136 37 649 Lua 1 42 24 284 make 16 35 14 275 Markdown 2 46 0 95 HTML 1 0 0 10 JSON 1 0 0 6 CMake 1 2 0 4 Bourne Again Shell 1 0 0 2 Ruby 1 0 0 2 -------------------------------------------------------------------------------- SUM: 79 1360 1006 6511 --------------------------------------------------------------------------------
-
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. ↩
-
Output from
cloc
. Core implementation iss7.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 -------------------------------------------------------------------------------
-
REPL binary compiled with GCC for RISC-V, dynamic linking to LibC. ↩
-
Compiled with
$CC s7.c -o s7-riscv -I. -DWITH_MAIN -DWITH_C_LOADER=0 -static -Os -lm -pthread -Wl,-export-dynamic
and stripped.In order for S7 to be useful with the C library, it needs
libc_s7.so
.libc_s7.so
is generated automatically by S7 when it loadsr7rs.scm
orlibc.scm
. It transpileslibc.scm
to C producinglibc_s7.c
. Then it loadscload.scm
to compile the generatedlibc_s7.c
intolibc_s7.so
.The technique that is theorised but still not successfully used to cross-compile S7 would be:
- Compile S7 natively, for example:
gcc s7.c -o s7 -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic
ortcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -rdynamic -DWITH_C_LOADER
-Wl,-export-dynamic
is needed! Otherwise some symbols, such ass7_f
will not be found and loadinglibc_s7.so
will fail.
- Run
./s7 r7rs.scm
so that S7 generateslibc_s7.c
- Compile S7 with a cross-compiler
riscv32-buildroot-linux-gnu-gcc s7.c -o s7-riscv -DWITH_MAIN -DWITH_C_LOADER=1 -ldl -static -Os -lm -I. -Wl,-export-dynamic
- Cross compile
libc_s7.c
, for exampleriscv32-buildroot-linux-gnu-gcc libc_s7.c -o libc_s7.so -shared -rdynamic -DWITH_MAIN -DWITH_C_LOADER=1 -Os -ldl -lm -I. -pthread -Wl,-export-dynamic
The method described above does not work as symbols are still not found:
↩s7: 22-Jun-2022 load /mnt/s7/libc_s7.so failed: /mnt/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x01;\x01;\x01;") ; (symbol "\x7f;ELF\x01;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ;unbound variable fileno in (fileno stdin) ; (fileno stdin) ; repl.scm, line 207, position: 6849 ; (fileno stdin) ; ((terminal-fd (fileno stdin)) (tab-as-spa... ; ((lambda (hook lst) (when (or (not (proce... ;unbound variable *repl* ; (*repl* 'run) ; ((*repl* 'run)) ; ((lambda (new-size) (unless (= new-size h... ; histsize: 100, histpos: 0 ; histbuf: #("" "" "" "" ...) ;
- Compile S7 natively, for example:
-
Compiling staticly does not work out of the box. It needs to then run
repl libc.scm
which generates alibc_s7.c
file and tries compiling it to alibc_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. ↩ -
Version 0.3.1
↩cloc . --exclude-dir=tests,examples 14 text files. 8 unique files. 8 files ignored. github.com/AlDanial/cloc v 1.92 T=0.19 s (41.4 files/s, 97154.8 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 1 1474 1975 11819 Scheme 5 272 606 1027 C/C++ Header 1 124 659 711 make 1 26 2 89 ------------------------------------------------------------------------------- SUM: 8 1896 3242 13646 -------------------------------------------------------------------------------
-
Compiled with
-Os -g0 -static
and stripped. ↩ -
The patch has been upstreamed.
Patched out nana and fixed TCC build.
↩fernando@localhost:~/Builds/Easy-ISLisp/eisl> cloc . --exclude-dir=example,tests,verify,documents,bench,nana-mv 146 text files. 138 unique files. 10 files ignored. github.com/AlDanial/cloc v 1.92 T=0.17 s (820.2 files/s, 270043.7 lines/s) --------------------------------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------------------------------- C 60 2693 1055 26234 Lisp 34 1154 973 7848 C/C++ Header 33 265 83 3124 Markdown 2 122 0 433 HTML 1 29 0 311 make 3 36 10 304 Windows Module Definition 1 0 1 286 Assembly 1 0 12 171 D 2 8 2 96 diff 1 12 91 84 --------------------------------------------------------------------------------------- SUM: 138 4319 2227 38891 ---------------------------------------------------------------------------------------
-
Default compile options (
-O3 -lto
) with-static
and stripped. ↩ -
LOC count generated from git checkout on 2024-02-11
↩fernando@localhost:~/Dirt/janet> scc --exclude-dir=examples,test,tools ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── C 46 34620 2427 2774 29419 5102 C Header 13 3419 446 667 2306 125 YAML 6 259 20 0 239 0 Markdown 3 1364 182 0 1182 0 Meson 2 345 8 23 314 3 Batch 1 180 28 0 152 15 Janet 1 4281 125 61 4095 80 License 1 19 3 0 16 0 Makefile 1 415 63 61 291 22 SVG 1 11 1 0 10 0 gitignore 1 154 32 34 88 0 ─────────────────────────────────────────────────────────────────────────────── Total 76 45067 3335 3620 38112 5347 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop (organic) $1,235,122 Estimated Schedule Effort (organic) 14.90 months Estimated People Required (organic) 7.36 ─────────────────────────────────────────────────────────────────────────────── Processed 1592052 bytes, 1.592 megabytes (SI) ───────────────────────────────────────────────────────────────────────────────
-
↩cloc . 73 text files. 70 unique files. 42 files ignored. github.com/AlDanial/cloc v 1.92 T=0.32 s (218.0 files/s, 134655.6 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 34 3259 3769 17327 HTML 3 3949 11 9013 C/C++ Header 28 1354 1492 2534 make 2 65 38 225 CSS 3 34 0 169 ------------------------------------------------------------------------------- SUM: 70 8661 5310 29268 -------------------------------------------------------------------------------
-
Compiled with
CFLAGS="-Os -static -fPIC"
and stripped. ↩ -
This includes some modules that could be taken out.
↩cloc . --exclude-dir=example.api,example.ext,freebsd,examples,sqlite3,tests,tools,jsmn,autosetup 113 text files. 86 unique files. 28 files ignored. github.com/AlDanial/cloc v 1.92 T=0.52 s (165.1 files/s, 102332.6 lines/s) --------------------------------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------------------------------- C 44 3965 5545 26287 HTML 1 108 0 9263 Tcl/Tk 19 330 554 2321 C++ 1 443 162 1671 C/C++ Header 10 233 586 930 Windows Module Definition 1 60 0 570 Bourne Shell 4 19 54 97 IDL 1 0 0 34 YAML 2 0 0 28 XML 1 0 0 11 make 1 8 10 11 m4 1 0 0 3 --------------------------------------------------------------------------------------- SUM: 86 5166 6911 41226 ---------------------------------------------------------------------------------------
-
Build system included as part of the source code.
↩~/Builds/jim-tcl/jimtcl/autosetup> cloc . 19 text files. 13 unique files. 6 files ignored. github.com/AlDanial/cloc v 1.92 T=0.59 s (22.0 files/s, 51834.1 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 1 3959 3192 15358 Bourne Shell 4 380 1012 4722 Tcl/Tk 8 169 605 1184 ------------------------------------------------------------------------------- SUM: 13 4508 4809 21264 -------------------------------------------------------------------------------
-
Compiled with
CC=riscv32-buildroot-linux-gnu-gcc CFLAGS="-static -Os -g0" ./configure --utf8 --math --disable-lineedit
. It can be made smaller if modules are disabled and if it is stripped. ↩ -
The results are great. And some errors come because of dynamic modules, which will always fail with this system.
↩root@buildroot:/mnt/jimtcl# LD_LIBRARY_PATH="/mnt/jimtcl:$(LD_LIBRARY_PATH)" ./jimsh "/mnt/jimtcl/tests/runall.tcl" [...] ========================================================================= Totals: Total 5462 Passed 5276 Skipped 176 Failed 11
-
LOC count generated from version 1.3.4
↩fernando@localhost:~/Dirt/mujs-1.3.4> scc . --exclude-dir=test262 ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── C 28 15789 1718 346 13725 2901 C Header 7 3431 191 74 3166 3 HTML 5 1159 266 0 893 0 CSS 1 40 2 0 38 0 JavaScript 1 152 17 26 109 29 License 1 16 4 0 12 0 Makefile 1 170 31 3 136 1 Python 1 79 5 2 72 7 gitignore 1 12 2 3 7 0 ─────────────────────────────────────────────────────────────────────────────── Total 46 20848 2236 454 18158 2941 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop (organic) $567,043 Estimated Schedule Effort (organic) 11.09 months Estimated People Required (organic) 4.54 ─────────────────────────────────────────────────────────────────────────────── Processed 458440 bytes, 0.458 megabytes (SI) ───────────────────────────────────────────────────────────────────────────────
-
Dynamically linked, stripped, optimization at
-Os
↩ -
LOC count generated from version 2024-01-13
↩fernando@localhost:~/Dirt/quickjs-2024-01-13> scc . --exclude-dir=tests,examples ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── D 18 23 0 0 23 0 C 14 85740 3309 1934 80497 8013 C Header 12 7752 430 438 6884 93 Plain Text 3 9 0 0 9 0 HTML 2 2144 179 52 1913 0 JavaScript 2 4247 270 172 3805 1013 Shell 2 199 64 15 120 21 License 1 22 4 0 18 0 Makefile 1 487 87 53 347 1 ─────────────────────────────────────────────────────────────────────────────── Total 55 100623 4343 2664 93616 9141 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop (organic) $3,173,313 Estimated Schedule Effort (organic) 21.33 months Estimated People Required (organic) 13.22 ─────────────────────────────────────────────────────────────────────────────── Processed 3365448 bytes, 3.365 megabytes (SI) ───────────────────────────────────────────────────────────────────────────────
-
Compiled dynamically using
make CROSS_PREFIX=riscv64-suse-linux-
, stripped with LTO enabled by default. ↩