🌀 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
Justin Ethier 584b31460b Added TODO
2017-12-18 17:34:18 -05:00
docs Thread-sleep allow fractional seconds 2017-11-13 18:41:10 -05:00
examples Thread-sleep allow fractional seconds 2017-11-13 18:41:10 -05:00
include/cyclone Issue #236 - Added C functions for single-byte I/O 2017-12-18 17:27:53 -05:00
scheme Added TODO 2017-12-18 17:34:18 -05:00
scripts Added with-handler 2017-02-10 23:13:42 +00:00
srfi Issue #218 - Fix startup issue 2017-09-04 18:57:23 -04:00
tests Partially-working version of letrec-syntax 2017-12-12 19:03:45 -05: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
C-API.md WIP 2017-02-24 16:30:18 -05:00
CHANGELOG.md Added full-unicode 2017-12-18 14:51:14 -05:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-07-01 22:49:01 -04:00
cyclone.scm Remove obsolete imports 2017-11-28 17:01:41 -05:00
Doxyfile Bump to 0.6 2017-08-21 22:45:39 -04:00
DoxygenLayout.xml New file 2017-02-24 13:48:47 -05:00
gc.c Add new string_type field 2017-10-20 16:29:47 +00:00
generate-c.scm Added header comment block. 2016-02-14 22:35:04 -05:00
icyc.scm Do not display unnecessary colon in error msgs 2017-08-18 17:33:12 -04:00
LICENSE Updated year 2015-07-22 21:30:15 -04:00
Makefile Added new linbrary 2017-12-15 14:23:11 -05:00
Makefile.config Use "rm -rf" instead of rmdir 2017-12-17 18:15:39 -05:00
Makefile.config.raspberry-pi-2 Sync 2017-11-25 02:57:08 +00:00
mstreams.c Cyc_io_get_output_string - populate num_cp correctly 2017-10-27 13:17:34 +00:00
README.md Revised feature list 2017-11-15 19:06:46 -05:00
runtime.c Issue #236 - Added C functions for single-byte I/O 2017-12-18 17:27:53 -05:00
sync.sh Initial file 2016-01-30 22:35:20 -05:00
test.c Fixed substring 2017-10-31 17:58:17 -04:00
tmp-macro-test.scm WIP 2017-12-15 14:17:14 -05: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.