Git Product home page Git Product logo

cyclone's Introduction

cyclone-scheme

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, with the intent to support as much of that language as possible.

Getting Started

  1. To install Cyclone on your machine for the first time use cyclone-bootstrap to build a set of binaries.

  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 and API documentation on the Scheme language features implemented by Cyclone.

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

  • This Benchmarks page by ecraven compares the performance of Cyclone with other R7RS and R6RS Schemes using a common set of benchmarks.

  • Finally, if you need another resource to start learning the Scheme language you may want to try a classic textbook such as Structure and Interpretation of Computer Programs.

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.

License

Copyright (C) 2014 Justin Ethier.

Cyclone is available under the MIT license.

cyclone's People

Contributors

jasonmacduffie avatar justinethier avatar kozross avatar ofosos avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.