Guile
By the GNU Project
Guile is GNU's official extension language, an implementation of Scheme designed to be embedded inside other applications so they can be scripted and extended by end users. It provides a Scheme interpreter and virtual machine, a foreign…
Definition
Guile is GNU's official extension language, an implementation of Scheme designed to be embedded inside other applications so they can be scripted and extended by end users. It provides a Scheme interpreter and virtual machine, a foreign function interface for calling C code, and a standard library, and is used both as a standalone Scheme implementation and as the embeddable scripting layer inside GNU software.
Overview
Guile was created to give GNU project applications a single, consistent scripting language instead of each program inventing its own ad hoc configuration or macro language. The idea, dating back to the early 1990s GNU extension-language effort, was that any C program could link against Guile's library, expose selected functions to it, and let users write real Scheme programs to automate or customize that application's behavior, rather than being limited to a narrow configuration file format. Mechanically, Guile compiles Scheme source into bytecode for its own virtual machine, which then executes it, though earlier versions used a simpler tree-walking interpreter. Its foreign function interface lets Scheme code call into C libraries and lets C host applications call back into Scheme, which is the mechanism that makes embedding practical: a text editor or package manager written in C can expose a handful of primitive operations to Guile and let arbitrarily complex user scripts drive them. Guile also implements much of the R7RS Scheme standard along with GNU-specific extensions for modules, dynamic-wind-based exception handling, and delimited continuations. Among Scheme implementations, Guile is distinguished less by raw performance, where implementations like Chez Scheme are generally faster, and more by its embedding-first design and its role as GNU's sanctioned extension language, similar in spirit to how Emacs Lisp is built specifically to extend Emacs. It differs from general-purpose Lisp dialects like Common Lisp by adhering to Scheme's minimalist core and lexical-scoping conventions, and it differs from other embeddable scripting languages like Lua by being a full Scheme with first-class continuations and a real macro system rather than a lighter procedural language. In practice, Guile's best-known deployment is inside GNU Guix, the functional package manager and Linux distribution, where entire package definitions and system configurations are written as Guile Scheme code rather than a bespoke DSL. It is also used to extend GNU applications such as GnuCash for financial scripting, and as a general-purpose standalone interpreter for people who want to write Scheme programs with access to a broad standard library and POSIX bindings. The trade-offs are those common to embeddable, general-purpose Scheme systems: it asks host applications to adopt Scheme rather than a lighter-weight configuration format, which is more powerful but a steeper investment for both integrators and end users unfamiliar with Lisp syntax. Compared to faster, more narrowly scoped Scheme implementations, Guile prioritizes standard-library breadth, GNU integration, and embeddability over peak execution speed, so performance-critical numeric code is not typically where it is chosen.
Key Features
- Implements the R7RS Scheme standard with GNU-specific extensions
- Compiles Scheme source to bytecode run on its own virtual machine
- Provides a foreign function interface for calling and being called from C
- Designed to be embedded inside host applications as a scripting layer
- Supports first-class continuations and a hygienic macro system
- Includes a module system for organizing larger Scheme codebases
- Serves as the configuration and package-definition language for GNU Guix
- Ships with POSIX bindings and a broad standard library