Git Product home page Git Product logo

peroxide's Introduction

Peroxide

A scheme interpreter in Rust. Aims for R5RS/R7RS compliance. Heavily based on the interpreter described in Lisp in Small Pieces.

Usage

You can just run cargo run to run the interpreter. Some internal options can be tweaked; try cargo run -- --help for more information.

Set RUST_LOG=peroxide=debug or RUST_LOG=peroxide=trace to see debugging information, especially GC-related messages. (This may make the system very slow.)

General implementation notes

This is a bytecode compiling implementation: scheme code is first converted to bytecode, then interpreted by a virtual machine.

The standard library is essentially ripped off Chibi Scheme. See init.scm for license details. Credit to Alex Shinn for writing it.

Peroxide is strictly single-threaded.

This comes with a very simple garbage collector. See the comment in heap.rs for implementation details. Unfortunately it meshes poorly with Rust's memory management. The key thing to remember when making changes, especially to the AST parser, is that any call to arena.insert() (the method used to ask the GC for memory) may trigger a garbage-collection pass and destroy anything that isn't rooted. Make sure to hold RootPtrs to any Scheme data you care about when doing stuff!

The macro system was another important implementation question. I ended up going with a system similar to Chibi Scheme's so that I could reuse more of the standard library ๐Ÿ™ƒ. This does mean that, in addition to syntax-case, Peroxide supports the more general syntactic closure macro paradigm. See doc/macros.md for details.

Todo

See todo.md for a list of things to do.

Useful references

peroxide's People

Contributors

jpellegrini avatar mattx avatar

Watchers

 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.