public
Description: Scheme in as little Ruby and as much Scheme as possible. Supports macros, continuations, tail recursion and lazy evaluation.
Homepage:
Clone URL: git://github.com/jcoglan/heist.git
heist / Rakefile
100644 44 lines (36 sloc) 1.231 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- ruby -*-
 
require 'rubygems'
require 'hoe'
require './lib/heist.rb'
 
Hoe.spec('heist') do |p|
  p.developer('James Coglan', 'jcoglan@googlemail.com')
  p.extra_deps = %w(oyster treetop)
end
 
file "lib/builtin/library.rb" => "lib/builtin/library.scm" do |t|
  program = Heist.parse(File.read t.prerequisites.first).convert!
  File.open(t.name, 'w') { |f| f.write 'program ' + program.to_ruby.inspect }
end
 
task :compile => "lib/builtin/library.rb"
 
namespace :spec do
  task :r5rs do
    procedures = Dir['r5rs/*.html'].
                 map { |f| File.read(f) }.
                 join("\n").
                 split(/\n+/).
                 grep(/(syntax|procedure)\:/).
                 map { |s| s.gsub(/<\/?[^>]+>/, '').
                             scan(/\(([^\) ]+)/).
                             flatten.
                             first }.
                 uniq.
                 compact.
                 map { |s| s.gsub('&lt;', '<').
                             gsub('&gt;', '>') }
    
    scope = Heist::Runtime.new.top_level
    procedures.each do |proc|
      message = scope.defined?(proc) ? scope.exec(proc) : 'MISSING'
      puts " %-32s %-48s" % [proc, message]
    end
  end
end
 
# vim: syntax=Ruby