Chicken Scheme
By the CHICKEN Scheme community
Chicken Scheme is an implementation of the Scheme programming language that compiles Scheme source into portable C code, which is then compiled by a standard C compiler into a native executable. This design lets Scheme programs run on…
Definition
Chicken Scheme is an implementation of the Scheme programming language that compiles Scheme source into portable C code, which is then compiled by a standard C compiler into a native executable. This design lets Scheme programs run on virtually any platform with a working C toolchain, and Chicken also includes an interpreter for interactive development alongside its ahead-of-time compiler and package manager.
Overview
Chicken Scheme addresses a portability problem common to Scheme implementations that generate native code directly: supporting a new CPU architecture or operating system normally means writing a new backend. Chicken sidesteps this by compiling Scheme to C, an intermediate target that already has mature, optimizing compilers available on nearly every platform in existence, from desktop operating systems to embedded devices. Mechanically, Chicken's compiler translates Scheme programs into C using continuation-passing style, a technique where a program's entire control flow, including function calls and Scheme's first-class continuations, is expressed through explicit continuation functions rather than the C call stack. This is what lets Chicken support proper Scheme semantics like tail calls and call/cc even though the target language, C, has neither natively. The generated C is then handed to a standard C compiler such as GCC or Clang, which applies its own optimizations before producing a native binary, effectively letting Chicken piggyback on decades of C compiler engineering. Among Scheme implementations, this compile-to-C approach places Chicken closer in philosophy to portability-first tools than to speed-first ones like Chez Scheme, which compiles straight to native machine code and generally achieves higher raw performance. Chicken trades some of that peak speed for the ability to cross-compile easily and run on unusual or resource-constrained targets. It also ships "eggs," Chicken's own package format and repository, giving it a practical library ecosystem more similar in spirit to how Racket or Guile bundle package managers than to bare reference Scheme implementations. In practice, Chicken is chosen for scripting and application development where portability across operating systems matters more than squeezing out maximum execution speed, and where developers want access to C libraries through its foreign function interface without leaving Scheme. It is used for small utilities, games, and embedded scripting, and its egg ecosystem covers common needs like networking, JSON parsing, and GUI bindings. The trade-offs are the ones inherent to a compile-to-C strategy: build times include an extra C compilation step, generated C code is not meant to be read or maintained by hand, and performance for numerically intensive code generally trails implementations with dedicated native-code compilers. For projects that need the fastest possible Scheme execution rather than portability and a straightforward foreign function interface, a native-code Scheme is usually the better fit. Debugging generated C in unusual failure modes also requires more familiarity with the compilation pipeline than debugging a native-code Scheme implementation's directly emitted machine code, which is a cost some teams weigh against Chicken's portability advantages.
Key Features
- Compiles Scheme source to portable C code, then to native binaries
- Uses continuation-passing style to support proper tail calls and call/cc
- Includes both an interpreter for development and an ahead-of-time compiler
- Ships eggs, its own package format and repository for third-party libraries
- Provides a foreign function interface for calling C libraries directly
- Runs on virtually any platform with a working C toolchain
- Supports cross-compilation by targeting C as an intermediate language