Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Scheme in as little Ruby and as much Scheme as possible. Supports macros, continuations, tail recursion and lazy evaluation.
Ruby Scheme
Pull request Compare This branch is 260 commits behind master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
sicp
test
.gitignore
History.txt
Manifest.txt
README.rdoc
Rakefile

README.rdoc

Heist

Heist is a Scheme written in Ruby, using as little Ruby and as much Scheme as possible. I'm developing it while reading SICP, Mockingbird and other Scheme and lambda calculus texts. The goal is to to be able to run all the example code I come across while learning something about interpreting programs. For the time being, the parser is generated using Treetop as Scheme's grammar is ridiculously simple and the interesting work is really in the interpreter and runtime.

By the way, Treetop is fantastic and I cannot recommend it highly enough; it makes generating parse trees from language grammars almost too easy:

treetop.rubyforge.org/

Goals

This a vague list right now as I'm just starting out, but I'd like to stick to them if at all possible.

  • Keep the grammar as small as possible

  • No keywords in the grammar, only generic Lisp syntax and data literals

  • All special forms are regular functions in the symbol table

  • Write as few primitives as possible in Ruby

  • Write as much in Scheme as possible, including tests

Features

I'm building this Scheme up as I learn the language. Heist nominally targets R5RS, though I'm also referring to SICP and PLT Scheme for guidance and extending as I see fit. The current aim is to have a complete R5RS syntax/semantics implemented, with library functions added as and when I need them.

  • Data primitives: only literals and proper lists so far

  • (define) for declaring variables, including function shorthand

  • First-class (lambda) expressions, lexical scoping, closures

  • Free variable assignment using (set!)

  • Scoped assignment: (let), (let*) and (letrec)

  • Control structures: (begin), (cond), (if)

  • R5RS macros, expanded and inlined at runtime

  • Tail call optimisation

  • (quote) for list literals, no quasiquoting yet

  • Numbers: integers, reals, rationals (sort of), arithmetic and other math functions

  • Booleans: literals, (and), (or), conditional logic and comparators

  • Utilities: (display), (eval), (runtime)

  • Load external files and libraries using (load)

License

(The MIT License)

Copyright © 2009 James Coglan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.