Kaappi – r7rs scheme written in Zig Kaappi, a complete R7RS-small Scheme implementation written in Zig, has been released with 641 built-in procedures, 32 syntax forms, 14 standard libraries, 171 SRFIs, a C FFI, OS threads and fibers, an LLVM native-code backend, a package manager, and a stepping debugger. The runtime uses a register-based bytecode VM with generational garbage collection and stack-copying first-class continuations, and was built with assistance from Anthropic's Claude AI. A complete R7RS-small Scheme implementation, written in Zig . Website https://kaappi-lang.org/ · Playground https://kaappi-lang.org/playground/ · Tour https://kaappi-lang.org/tour/ · Guide https://kaappi-lang.org/guide/ · Download https://kaappi-lang.org/download/ Kaappi implements every identifier from R7RS Appendix A https://small.r7rs.org/ — 641 built-in procedures, 32 syntax forms, and all 14 standard libraries — plus 171 SRFIs, a C FFI, OS threads and fibers, an LLVM native-code backend, a package manager, and a stepping debugger. The runtime is a register-based bytecode VM with generational garbage collection and stack-copying first-class continuations. The name is Malayalam and Tamil for coffee — see the FAQ https://kaappi-lang.org/faq/ for the story. Note:Kaappi was built with the assistance of AI Claude by Anthropic . No install needed — run Scheme in your browser at the playground https://kaappi-lang.org/playground/ , or take the guided 12-lesson . https://kaappi-lang.org/tour/ tour curl -fsSL https://kaappi-lang.org/install.sh | bash This installs kaappi and thottam the package manager to ~/.local/bin/ and the standard libraries to ~/.kaappi/lib/ , verifying SHA256 checksums along the way. On the BSDs the script works from the base system alone — when neither curl nor wget is installed it falls back to the base fetch FreeBSD or ftp OpenBSD, NetBSD for downloads and sha256 for verification. Prebuilt binaries for every platform are on the releases page https://github.com/kaappi/kaappi/releases/latest . macOS binaries are Developer ID signed and notarized; all releases ship SHA256SUMS with a GPG signature SHA256SUMS.asc , key at keybase.io/baijum https://keybase.io/baijum . See the download page https://kaappi-lang.org/download/ for manual install and verification steps. Requires Zig 0.16+ and a C toolchain for the vendored linenoise library : git clone https://github.com/kaappi/kaappi.git cd kaappi zig build → zig-out/bin/kaappi zig build run launch the REPL zig build run -- program.scm run a Scheme file zig build test run the unit tests | OS | Architecture | Build | Tests | Native compilation | |---|---|---|---|---| | macOS | aarch64 Apple Silicon | yes | yes | LLVM backend | | Linux | x86 64 | yes | yes | LLVM backend | | Linux | aarch64 | yes | yes | LLVM backend | | Linux | riscv64 | yes | yes | interpreter only | | Linux | s390x big-endian | yes | yes | interpreter only | | Linux | ppc64le | yes | yes | interpreter only | | Windows | aarch64 ARM64 , x86 64 | yes | yes | LLVM backend needs a C toolchain | | FreeBSD | x86 64, aarch64 | yes | yes | LLVM backend base cc suffices | | OpenBSD | x86 64, aarch64 | yes | yes | LLVM backend base cc suffices | | NetBSD | x86 64, aarch64 | yes | yes | LLVM backend needs pkgsrc clang ; base cc is GCC | | WebAssembly | wasm32-wasi | yes | — | interpreter only | The WASM build zig build wasm runs in browsers and WASI runtimes — it powers the playground https://kaappi-lang.org/playground/ . The Windows port zig build -Dtarget=aarch64-windows or -Dtarget=x86 64-windows covers the full interpreter — REPL plain line editing, no history/completion , fibers, channels, OS threads, FFI LoadLibrary , and the kaappi test runner. thottam installs packages on Windows too with Git for Windows on PATH ; only manifests with a build: command are refused — the C-FFI packages' Makefiles target POSIX. Platform differences: fd readiness covers sockets event-driven, WSAEventSelect and pipes polled — file ports keep blocking reads timers and cross-thread wakeups always work — and the POSIX-only slice of SRFI-170 uid/gid, symlinks, chmod/umask, user/group info raises a catchable file error. cond-expand distinguishes the platforms: Windows builds expose the windows feature identifier instead of posix . The FreeBSD port zig build -Dtarget=x86 64-freebsd or aarch64-freebsd is full POSIX with no degradations: kqueue-backed fiber I/O, OS threads, complete SRFI-170, the full linenoise REPL, and thottam with build: support. kaappi compile links native binaries with the base system's cc — no extra toolchain needed. The OpenBSD port zig build -Dtarget=x86 64-openbsd or aarch64-openbsd is the same full-POSIX kqueue platform — fiber I/O, threads, complete SRFI-170, the full REPL, build: support, and native compilation with base cc . Two accommodations for OpenBSD's hardening, both automatic: each binary is marked PT OPENBSD NOBTCFI at build time to opt out of BTCFI enforcement Zig 0.16 emits no BTI landing pads , and the interpreter raises its own stack limit at startup to clear OpenBSD's tight 4 MiB default. See docs/dev/openbsd.md /kaappi/kaappi/blob/main/docs/dev/openbsd.md . The NetBSD port zig build -Dtarget=x86 64-netbsd or aarch64-netbsd completes the BSD trio — the same full-POSIX kqueue feature set, verified on NetBSD 10.1. The runtime binds NetBSD's versioned libc symbols explicitly kevent50 , opendir30 , getpwnam50 — the plain names are old-ABI compat symbols that silently misparse modern structs and resets the aarch64 FPCR at startup, which NetBSD boots in flush-to-zero mode that would break IEEE gradual underflow. The native backend kaappi compile needs clang from pkgsrc — NetBSD's base cc is GCC, which can't consume LLVM IR. See docs/dev/netbsd.md /kaappi/kaappi/blob/main/docs/dev/netbsd.md . bash $ kaappi kaappi define fib n ... if < n 2 n ... + fib - n 1 fib - n 2 kaappi fib 20 6765 kaappi map lambda x x x ' 1 2 3 4 5 1 4 9 16 25 kaappi the answer is , 6 7 the answer is 42 kaappi string-length "héllo" 5 kaappi char-alphabetic? \λ t The REPL has syntax highlighting , line editing , persistent history ~/.kaappi/history , tab completion for all built-in and user-defined symbols, and multi-line input with automatic paren balancing. define-syntax my-when syntax-rules my-when test body ... if test begin body ... my-when t display "hello world" newline define-library mylib math export square cube import scheme base begin define square x x x define cube x x x x import mylib math cube 5 ;= 125 define saved f + 1 call/cc lambda k set saved k 10 ;= 11 saved 42 ;= 43 Proper tail calls — define loop n loop + n 1 runs forever without growing the stack First-class continuations — multi-shot call/cc via stack copying, dynamic-wind for cleanup Exception handling — guard , raise , with-exception-handler , typed error objects file-error? , read-error? Hygienic macros — syntax-rules with scope-based renaming; pattern variables, ellipsis, literals, underscore wildcards Library system — define-library , import with only / except / rename / prefix , .sld file loading, cond-expand Numeric tower — fixnum, bignum arbitrary precision , exact rational, flonum IEEE 754 f64 , complex; automatic promotion on overflow Full Unicode — UTF-8 strings indexed by codepoint, Unicode character classification and case mapping Records, ports, lazy evaluation, multiple values, parameters — the whole standard, with no known functional gaps 171 SRFIs — 12 built-in, 156 as portable .sld libraries, plus SRFI 261 portable library references srfi srfi-1 , srfi lists-1 resolved in the importer and SRFI 226/160 as sub-libraries only full list in CONFORMANCE.md /kaappi/kaappi/blob/main/CONFORMANCE.md Native binaries — kaappi compile program.scm -o program compiles Scheme to a native executable via LLVM, with self-tail-calls compiled as loops details /kaappi/kaappi/blob/main/docs/dev/llvm-backend.md Standalone bundles — zig build -Dbundle-src=program.scm embeds bytecode + libraries in a single executable C FFI — call shared libraries from Scheme via kaappi ffi ; 18 marshalled types, callbacks for passing Scheme procedures to C Concurrency — green threads with channels via kaappi fibers , plus real OS threads via SRFI-18 Stepping debugger — breakpoints with conditions , watch expressions, step/next/step-out, frame navigation, locals — all from the REPL Profiler — kaappi --profile or ,profile expr : per-function self/total time, call counts, allocation bytes Sandbox mode — kaappi --sandbox blocks FFI, file I/O, eval , load , and environment access Bytecode caching — compiled .sbc files are reused when the source is unchanged Machine-legible diagnostics — every error carries a stable KP code error KP3001 , with --diagnostics=json LSP shape , kaappi explain