Project

rbsiev

0.0
No release in over a year
An evaluator of Scheme language written in Ruby, which is implemented in SICP Chater 4.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.3
>= 0.1.4
 Project Readme

Rbsiev

Build Status

SICP evaluator in Ruby.

Or, Ruby で書いた SICP の evaluator.

It is intended to be a part of Scheme implementation written in Ruby.

Installation

Execute:

$ gem install rbsiev

Usage

Run the simple REPL as:

$ rbsiev

Then, you can input Scheme program.

Supported Syntax

In 0.1.0, the evaluator mostly corresponds to the one in SICP 4.1.1 - 4.1.6.

See the wiki page for more information about the progress of implementing.

Literals

  • boolean value (#f and #t),
  • an empty list (()),
  • a string enclosing with double-quotations, such "hoge"
  • numbers (integer, real, rational, and complex)

Primitive procedures

  • arithmetic operators (+, -, *, /, %),
  • comparison operators (=, <, >, <=, >=)
  • cons, car, cdr
  • null?, pair?, list?, number?
  • list, append
  • write, display

Syntax to be evaluated

  • lambda expression
    • such (lambda (n) (+ n 1))
  • procedure application
    • such (foo 1)
  • conditional expression
    • if, cond, when, unless
  • logical test
    • and, or
  • assignment
    • set!
  • definition
    • define
  • sequence
    • begin
  • local bindings
    • let, let*, letrec, letrec*
  • loop
    • do

Related projects

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mnbi/rbsiev.

License

The gem is available as open source under the terms of the MIT License.