All Projects → MattX → peroxide

MattX / peroxide

Licence: Apache-2.0 License
Scheme in Rust

Programming Languages

rust
11053 projects
scheme
763 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to peroxide

Animach
Scheme语言实现和运行时环境 / A Scheme runtime & implementation
Stars: ✭ 45 (+221.43%)
Mutual labels:  scheme-interpreter
genyris
Genyris presents a new programming paradigm. Objects can belong to multiple classes independent from construction allowing data to be classified into types after creation.
Stars: ✭ 14 (+0%)
Mutual labels:  scheme-interpreter
abap scheme
ABAP Scheme
Stars: ✭ 13 (-7.14%)
Mutual labels:  scheme-interpreter
compiler-tutorial
Incremental Compiler paper by Abdulaziz Ghuloum, using Chez scheme, Nasm, x86_64 for OSX
Stars: ✭ 41 (+192.86%)
Mutual labels:  scheme-interpreter
JSchemeMin
A small scheme implementation in java
Stars: ✭ 22 (+57.14%)
Mutual labels:  scheme-interpreter

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].