🌀 A brand-new compiler that allows practical application development using R7RS Scheme. We provide modern features and a stable system capable of generating fast native binaries.
Find a file
2018-10-05 17:32:28 -04:00
docs Revised wording 2018-08-09 11:54:07 -04:00
examples New file for Issue #248 2018-03-26 11:21:56 -04:00
include/cyclone Revert previous changed due to issues with SRFI 143 2018-10-04 11:11:16 -04:00
scheme Bump to 0.9.4 2018-10-03 09:47:57 -04:00
scripts Updated API index 2018-02-02 14:44:09 +00:00
srfi Issue #176 - Improve hash-by-identity 2018-05-01 13:27:59 -04:00
tests Added notes 2018-10-05 17:32:28 -04:00
.gitignore Fixing .gitignore so that test.txt doesn't get added to git tree 2017-02-03 17:29:10 +13:00
.travis.yml Add Linux and macOS continuous integration on Travis 2017-11-10 21:47:34 -08:00
AUTHORS Update AUTHORS 2017-09-07 17:22:30 -04:00
CHANGELOG.md Bump to 0.9.4 2018-10-03 09:47:57 -04:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-07-01 22:49:01 -04:00
cyclone.scm Enable lambda renumbering 2018-09-25 12:38:46 -04:00
Doxyfile Bump to 0.9.x 2018-08-24 11:56:38 -04:00
DoxygenLayout.xml New file 2017-02-24 13:48:47 -05:00
gc.c Prevent segfault on ARM 2018-10-02 18:59:33 -04:00
generate-c.scm Added header comment block. 2016-02-14 22:35:04 -05:00
icyc.scm Issue #253 - Cut over to new repl function 2018-04-30 20:29:01 -04:00
LICENSE Updated year 2015-07-22 21:30:15 -04:00
Makefile Install meta file 2018-01-31 16:00:42 -05:00
Makefile.config Added CYC_PROFILING 2018-08-03 11:59:22 -04:00
Makefile.config.raspberry-pi-2 Sync 2017-11-25 02:57:08 +00:00
mstreams.c Updated Cyc_io_get_output_bytevector for huge bv's 2018-01-03 14:37:39 -05:00
README.md Revised feature list 2017-11-15 19:06:46 -05:00
runtime.c Issue #278 - Fix compiler warning 2018-10-02 11:28:07 -04:00
sync.sh Initial file 2016-01-30 22:35:20 -05:00
test-eval-compilation.scm Adding file temporarily for testing 2018-09-23 18:23:27 -04:00

cyclone-scheme

Travis CI

Cyclone is a brand-new Scheme-to-C compiler that allows practical application development using R7RS Scheme. Cheney on the MTA is used by Cyclone's 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.

Features

  • 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 syntax-rules
  • 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

Getting Started

  1. 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).

  2. After installing you can run the cyclone command to compile a single Scheme file:

     $ cyclone examples/fac.scm
     $ examples/fac
     3628800
    

    And the icyc command 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 rlwrap to make the interpreter more friendly, EG: rlwrap icyc.

  3. Read the documentation below for more information on how to use Cyclone.

Documentation

  • 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.

  • Finally, this benchmarks page by ecraven compares the performance of Cyclone with other Schemes.

Example 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 - The Conway's game of life example program and libraries from R7RS.

  • 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 cyclone.scm and icyc.scm to create executables for Cyclone's compiler and interpreter.

Compiler Internals

  • 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.

License

Copyright (C) 2014 Justin Ethier.

Cyclone is available under the MIT license.