Cyclone is a brand-new Scheme-to-C compiler that allows practical development of applications using R7RS Scheme. Cheney on the MTA is used by the runtime to implement full tail recursion, continuations, and generational garbage collection. In addition, the Cheney on the MTA concept has been extended to allow execution of multiple native threads. An on-the-fly garbage collector is used to manage the second-generation heap and perform major collections without “stopping the world”.
Cyclone is the first compiler written entirely in the latest R7RS Scheme language standard, and the intent is to support as much of that language as possible.
- Support for the majority of the Scheme language as specified by the latest R7RS standard.
- New features from R7RS including libraries, exceptions, and record types.
- Built-in support for Unicode strings and characters.
- Hygienic macros based on
- Low-level explicit renaming macros
- Guaranteed tail call optimizations
- Native multithreading support
- A foreign function interface that allows easy integration with C
- A concurrent, generational garbage collector based on Cheney on the MTA
- Includes an optimizing Scheme-to-C compiler,
- … as well as an interpreter for debugging
- Support for many popular SRFI’s
- Online user manual and API documentation
To install Cyclone on your machine for the first time use cyclone-bootstrap to build a set of binaries. Instructions are provided for Linux, Mac, and Windows (via MSYS).
After installing you can run the
cyclonecommand to compile a single Scheme file:
$ cyclone examples/fac.scm $ examples/fac 3628800
icyccommand to start an interactive interpreter:
$ icyc :@ @@@ @@@@: `@@@@@+ .@@@+@@@ Cyclone @@ @@ An experimental Scheme compiler ,@ https://github.com/justinethier/cyclone '@ .@ @@ #@ (c) 2014 Justin Ethier `@@@#@@@. Version 0.0.1 (Pre-release) #@@@@@ +@@@+ @@# `@. cyclone> (write 'hello-world) hello-world
You can use
rlwrapto make the interpreter more friendly, EG:
Read the documentation below for more information on how to use Cyclone.
The User Manual covers in detail how to use Cyclone and provides information on the Scheme language features implemented by Cyclone.
An API Reference is available for all libraries provided by Cyclone, including a complete alphabetical listing.
If you need a resource to start learning the Scheme language you may want to try a classic textbook such as Structure and Interpretation of Computer Programs.
Cyclone provides several example programs, including:
Tail Call Optimization - A simple example of Scheme tail call optimization; this program runs forever, calling into two mutually recursive functions.
Threading - Various examples of multi-threaded programs.
Game of Life PNG Image Generator - A modified version of game of life that uses libpng to create an image of each iteration instead of writing it to console. This example also demonstrates basic usage of the C Foreign Function Interface (FFI).
Finally, the largest program is the compiler itself. Most of the code is contained in a series of libraries which are used by
icyc.scmto create executables for Cyclone’s compiler and interpreter.
Writing the Cyclone Scheme Compiler provides high-level details on how the compiler was written and how it works.
There is a Development Guide with instructions for common tasks when hacking on the compiler itself.
Cyclone’s Garbage Collector is documented at a high-level. This document includes details on extending Cheney on the MTA to support multiple stacks and fusing that approach with a tri-color marking collector.
Recent NewsJan 19 2019
This release contains many compiler optimization fixes and speeds up compilation of large programs. Dec 09 2018
This release contains bug fixes for the most recent set of compiler optimizations. Nov 28 2018
This release includes minor improvements to the runtime.