-
Notifications
You must be signed in to change notification settings - Fork 32
/
Rakefile
38 lines (32 loc) · 1.22 KB
/
Rakefile
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
require 'rubygems'
require File.expand_path('../lib/heist', __FILE__)
file "lib/heist/builtin/compiled_library.rb" do |t|
library_source = %w[util logic numeric list character string vector].
map { |l| File.read "lib/heist/builtin/lib/#{l}.scm" }.
join("\n\n")
program = Heist.parse(library_source).convert!
File.open(t.name, 'w') { |f| f.write 'program ' + program.to_ruby.inspect }
end
task :compile => "lib/heist/builtin/compiled_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('<', '<').
gsub('>', '>') }
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