Skip to content
Marc Feeley edited this page Nov 6, 2023 · 2 revisions

This wiki is intended for users of the Gambit Scheme system. It is a place where various resources are collected and where users can exchange information related to Gambit. The information found here may be incomplete, outdated, or incorrect. The old wiki site, which is now deprecated and read-only, can be found here. Some links in the new wiki still point to the old one. Feel free to update things and contribute new material.

What's Gambit?

Gambit consists of two main programs: gsi, the Gambit Scheme interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains the complete execution and debugging environment. The compiler is the interpreter extended with the capability of generating executable files. The compiler can produce standalone executables or compiled modules which can be loaded at run time. Interpreted code and compiled code can be freely mixed.

Currently the compiler supports generating C or JavaScript code. The name Gambit-C refers to the version of the system that generates C code, which is more mature, more featurefull, and faster than Gambit-JS, the version of the system that generates JavaScript code. The main features of Gambit-C are:

  • Conformance. The Gambit-C system conforms to the R4RS, R5RS and IEEE Scheme standards and implements all optional features. Tail calls and first class continuations conform to the Scheme semantics. The full numeric tower is implemented, including: arbitrary precision integers (bignums), rationals, inexact reals (floating point numbers), and complex numbers. Several extensions to Scheme are provided, including: lightweight threads, a foreign-function interface (FFI), and extended I/O capabilities (Unicode, networking, subprocesses, ...).

  • Portability. Because the system is mostly written in Scheme and the Gambit-C compiler generates portable C code, it is easy to port the system as well as programs compiled with it to any platform with a decent C or C++ compiler. There is no reliance on a particular C compiler, although the system can take advantage of some gcc and clang specific constructs. The C code generated is oblivious to the endianness and word size of the target environment (32 and 64 bit architectures are currently supported). There are no external library dependencies, and OS API dependencies can be removed so as to run directly on the bare metal. The system includes high-performance bignum support utilizing sophisticated algorithms, implemented in Scheme.

  • Performance. The compiler includes several powerful program transformations such as user procedure inlining, partial-evaluation, and lambda-lifting. With appropriate declarations in the source code the executable programs generated by the compiler run roughly as fast as equivalent C programs, sometimes faster, sometimes slower. Programs containing no declarations are also optimized without compromising the Scheme semantics by speculatively inlining predefined procedures (see the benchmarks page for a comparison with other Scheme implementations and other languages). Thanks to an efficient implementation of continuations, the thread system is very efficient and can support millions of concurrent threads.

  • Reliability. Stable releases typically have very few bugs. Gambit-C has been used to develop large-scale real-world software and services in academic and commercial settings.

Source repository

The Gambit repository is hosted on github here.

Reporting bugs

Please use the issue tracker on github.

Presentations and research papers on Gambit

  • An overview of the Gambit system was presented at the 2010 International Lisp Conference ("Gambit Scheme: Inside Out" slides).

  • The Gambit-JS version was first explained in a paper at the 2015 Dynamic Languages Symposium ("Compiling for Multi-language Task Migration" paper and slides).

  • "Tail Calling Between Code Generated by C and Native Backends" paper and slides from the 2018 Scheme Workshop.

  • "An R7RS Compatible Module System for Termite Scheme" paper and slides from the 2020 European Lisp Symposium.

  • The presentations from the 2019 Gambit@30 event were recorded and the slides and videos are available here.

Gambit web page

Some useful information can be found on the Gambit web page:

License

Gambit is Copyright © 1994-2023 by Marc Feeley. It is released under a dual LGPL and Apache 2 license. You can choose whichever license you prefer:

Clone this wiki locally