RbScheme
An implementation of Scheme subset written in Ruby. It's based on the Stack-Based model introduced in Three Implementation Models for Scheme by R. Kent Dybvig. The model is implemented by a compiler and virtual machine.
Features
- first class closures
- global variables
- integers/symbols/cons cell/true/false
- variadic function
- call/cc(limitation exists)
- if
- basic arithmetic functions(+ - * /)
- set!
- tail call optimization
Install
$ gem install rb-scheme
Usage
Run
repl
$ rb-scheme
You can use rlwrap for readline
$ rlwrap rb-scheme
with file
$ rb-scheme examples/nqueen.scm
primitives
- numeric(
+,-,*,/) - predicate(
=,<,>,null?) - lisp operations(
cons,car,cdr,list) - print(
display,newline,print)
examples
see examples folder
Development
$ bundle install
$ rake test
License
The gem is available as open source under the terms of the MIT License.