Due to one of the tabs at the top of this piddlin’ little blog being labeled “Programming”, I figured that it might be time to actually post something about programming.

Just announced today is Heist, a SchemeW interpreterW written in RubyW. Personally, I think that James Coglan should have written it in BASH 4.0 but that is only because I’m a sadist.

For those of you that have never touched a real programming language before, Scheme is a dialect of WLISP, the second oldest (arguably) programming language in existence. Guess what? It’s still in use today…it’s that good.

tongues Ruby Schemes Heist

Lisp was the first language to implement conditionals, first class functions (lambdas), closures and recursion. Some Lisp features, such as closures and macros, have yet to penetrate mainstream languages and it has been observed that mainstream languages are slowly converging on the feature set of Lisp.

Scheme in particular is important for its influence on current languages, in particular JavaScript and Ruby (JavaScript is remarkably similar to Scheme if you ignore the syntactic differences). It is also used in the much-praised book “Structure and Interpretation of Computer Programs”, wherein it is used to explore some of the theory surrounding interpreters.

It is a functional language, in that it supports first-class functions and many constructs that would be syntax in other languages resemble function calls in Scheme. However it is not purely functional as it allows side effects, and is more procedural in nature than, say, a declarative language such as Haskell. Like other Lisps, its lack of predefined syntax and its support for macros (functions that rewrite source code) make it ideal for creating new syntactic forms and embedded languages.

Heist is an interpreter for the Scheme programming language, written in Ruby, that can run Scheme programs in standalone fashion and can be embedded in, and extended using, Ruby applications.

The If Works » Blog Archive » Announcing Heist, a new Scheme implementation written in Ruby

Installation is a snap, assuming the gem has been mirrored to the gem repos by the time you read this:

sudo gem install hoe
sudo gem install heist

Heist runs on Ruby 1.8 and seems fine on 1.9, and partly works on Rubinius.

The If Works » Blog Archive » Announcing Heist, a new Scheme implementation written in Ruby

The astonishing thing is how small this is. The runtime (that’s the engine that executes code after it’s been parsed and on top of which the built-in functions are implemented) is, very roughly, 780 lines of Ruby, and you can throw most of that away if you don’t want the advanced features. Macros are 250 lines, continuation support about 200, and if you throw out tail calls you’re under 300 lines. The parser is a dozen or so Treetop rules, and the built-in functions are a few hundred lines of Ruby and Scheme macros. All very small and relatively digestible for someone wanting to get into language implementations.

The If Works » Blog Archive » Announcing Heist, a new Scheme implementation written in Ruby

Scheme in as little Ruby and as much Scheme as possible. Supports macros, continuations, tail recursion and lazy evaluation.

jcoglan’s heist at master – GitHub

(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.

README.rdoc at d610c62482d2faad091d728a45183bf7251178e9 from jcoglan’s heist – GitHub

In Soviet Russia, Post's Bookmark YOU!!
  • Facebook
  • Technorati
  • Google Bookmarks
  • StumbleUpon
  • Reddit
  • Yahoo! Buzz
  • Sphinn

Glue Huffing Chickens Picked These Posts: