Scheme Interpreter in Ruby
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
lispy.rb

README.md

README

  • A Lisp (Scheme) interpreter in Ruby; includes a REPL.

  • Run directly

$ chmod a+x ./lispy.rb  
$ ./lispy.rb
>>> (+ 5 2)
7
  • Or use require
$ irb
ruby-1.9.2-p290 :001 > require './lispy.rb'
 => true 
ruby-1.9.2-p290 :002 > repl ">>> "
>>> (+ 39 3)
42
  • The interpreter supports basic Scheme syntax
>>> (define r 5)
5
>>> (* 40 r)
200
>>> (if (< 10 11) (+ 5 12) (* 19 20))
17
>>> (define area (lambda (r) (* 3.141592653 (* r r))))
#<Proc:0x007ff8588342a0@./lispy.rb:77 (lambda)>
>>> (area 51)
8171.282490453