Tech News
← Back to articles

SIOF (Scheme in One File) – A Minimal R7RS Scheme System

read original related products more articles

SIOF (Scheme In One File) - A Minimal R7RS Scheme System

SIOF is a portable interpreter for the R7RS Scheme programming language. It can be built from a single C source file siof.c; there are no OS- or hardware-specific parts, no compiler-specific tricks, no dependency on platform-specific building tools. There is no distributives or packages: just compile the source file with your favorite C compiler, link it with the standard C runtime libraries and be done with it. For some platforms, precompiled binaries are available (please see releases).

Installation

Here's how you can compile SIOF on a unix box using GCC:

gcc -o siof siof.c -lm

Please note that some compilers may issue hundreds of warnings; we recommend to add -Wno-parentheses-equality for Clang and -D_CRT_SECURE_NO_WARNINGS for Windows headers (unless you want to hear that fopen is no longer a reasonable way to open files). Some compilers link library automatically, some require explicit option like -lm above.

For better performance (up to 3x of the baseline) and smaller executable, you may add optimization flags, e.g.:

gcc -o siof -O3 -DNDEBUG siof.c -lm

If you do that, be ready for long compilation times (actual time varies widely from ~1 minute to more than an hour, depending on the compiler and optimization level). On systems supporting 32-bit applications such as Windows, it may make sense to compile SIOF in 32-bit mode; performance is almost the same, but both the executable and runtime memory footprint are noticeably smaller.

The resulting interpreter has no dependencies (except C runtime and standard -lm math library) and can be run from any location. If compiled statically, it can be easily moved between systems with the same ABI.

... continue reading