Giter Site home page Giter Site logo

rusty_scheme's Introduction

RustyScheme

A toy Scheme interpreter written in Rust, loosely based on the R5RS Specification with a bit of Racket thrown in as well.

It supports a small number of standard library functions, as well as:

  • Function and variable definition
  • Quote, Quasiquote/unquote
  • Apply & Eval
  • Macros (not hygenic yet)
  • Let expressions
  • Tail-call optimization
  • Continuations, Call-with-current-continuation
  • Unicode
  • REPL, with history

There are two versions of the interpreter:

  • A straight-forward AST-walking interpreter, which uses the Rust stack and heap, and uses vectors to represent Scheme lists.
  • A continuation-passing style interpreter, which supports tail-call optimization and continuations, uses the Rust stack and heap, and uses a linked list to represent Scheme lists.

In the future, I may develop an interpreter that manages its own stack and/or heap, and possibly a bytecode VM & compiler as well for comparison.

Requirements

  • Rust 1.0-beta or later

Usage

Download and install Rust 1.0 from http://www.rust-lang.org/install.html.

To start a REPL using the default CPS interpreter:

cargo run

To execute a Scheme file using the default CPS interpreter:

cargo run examples/printing.scm

To start a REPL using the AST-walking interpreter:

cargo run -- -t ast_walk

To execute a Scheme file using the AST-walking interpreter:

cargo run -- -t ast_walk examples/printing.scm

To run the test suite:

cargo test

To watch for changes and auto-rebuild (on OS X):

gem install kicker -s http://gemcutter.org
./watch

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.