🌀 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
2019-09-24 18:18:07 -04:00
.github Create FUNDING.yml 2019-07-20 21:50:04 -04:00
docs Keep track of notes for a potential future guide 2019-07-22 13:14:44 -04:00
examples Fix library reference 2019-06-14 13:13:22 -04:00
include/cyclone Issue #337 2019-09-15 10:40:06 -04:00
libs Fix deref of delays 2019-07-11 18:11:08 -04:00
scheme Use lambda ID's to confirm if var truly is a loop 2019-09-24 18:18:07 -04:00
scripts Process new libs directory 2019-07-03 17:56:20 -04:00
srfi Issue #326 - Use timer to seed pseudorandom numbers 2019-07-24 13:19:38 -04:00
tests Remove dead code 2019-07-02 13:27:00 -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 Fix Concurrency Kit version tag in Travis 2019-07-31 23:03:23 +03:00
AUTHORS Add credit for latest build fixes, thanks! 2019-04-09 13:25:27 -04:00
CHANGELOG.md Issue #337 2019-09-15 10:40:06 -04:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-07-01 22:49:01 -04:00
cyclone.scm Issue #336 - Compiler validation for "if" 2019-09-10 18:52:44 -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 Forgot to lock for new_mutators 2019-06-11 15:54:12 -04:00
generate-c.scm Added header comment block. 2016-02-14 22:35:04 -05:00
hashset.c Initial file 2018-12-19 13:28:34 -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 Sync new file 2019-09-10 17:36:06 -04:00
Makefile.config Do not use fPIC when cyclone compiles programs 2019-05-23 14:16:27 -04:00
Makefile.config.raspberry-pi-2 Sync up changes from primary config 2019-04-12 18:04:42 -04:00
mstreams.c Refactoring 2019-08-22 21:28:57 -04:00
README.md Successfuly installed and tested Cyclone on FreeBSD 12.0 with clang 6.0.1. Updated docs, adaptaed sync.sh and corrected Makefile 2019-07-29 06:58:52 -03:00
rewrite-closure.scm Initial file 2019-09-18 13:29:24 -04:00
runtime.c Issue #337 2019-09-15 10:40:06 -04:00
sync.sh Successfuly installed and tested Cyclone on FreeBSD 12.0 with clang 6.0.1. Updated docs, adaptaed sync.sh and corrected Makefile 2019-07-29 06:58:52 -03:00
test-clo.scm WIP 2019-03-21 17:08:16 -04:00
validation.scm Use lambda ID's to confirm if var truly is a loop 2019-09-24 18:18:07 -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 on Linux, Windows, FreeBSD, and for Mac users wanting to install without using Homebrew, use cyclone-bootstrap to build a set of binaries. Instructions are provided for Linux, Mac, Windows (via MSYS), and FreeBSD 12.

    Mac users wanting to use Homebrew can do the following:

    • If Homebrew is not already installed: follow the instructions at https://brew.sh/ to install the homebrew package manager.
    • brew tap cyclone-scheme/cyclone
    • brew install cyclone-scheme/cyclone/cyclone

    Arch Linux users can install using the AUR.

  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 Scheme->C compiler
           ,@             http://justinethier.github.io/cyclone/
           '@
           .@
            @@     #@     (c) 2014-2019 Justin Ethier
            `@@@#@@@.     Version 0.11
             #@@@@@
             +@@@+
             @@#
           `@.
    
     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.