|
@ -46,7 +46,15 @@ module Crisp |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def eval_string(str) |
|
|
def eval_string(str) |
|
|
print(@evaluator.eval(read(str), @env)) |
|
|
|
|
|
|
|
|
@evaluator.eval(read(str), @env) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def eval(t : Crisp::Type) |
|
|
|
|
|
@evaluator.eval(t, @env) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def eval(val) |
|
|
|
|
|
@evaluator.eval(Crisp::Type.new val, @env) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def run(filename = nil) |
|
|
def run(filename = nil) |
|
@ -57,7 +65,7 @@ module Crisp |
|
|
|
|
|
|
|
|
while line = Readline.readline("Crisp> ", true) |
|
|
while line = Readline.readline("Crisp> ", true) |
|
|
begin |
|
|
begin |
|
|
puts eval_string(line) |
|
|
|
|
|
|
|
|
puts kp">self.print(eval_string(line)) |
|
|
rescue e |
|
|
rescue e |
|
|
puts e.message |
|
|
puts e.message |
|
|
end |
|
|
end |
|
|