Class: Nydp::Runner
Instance Attribute Summary
Attributes inherited from Evaluator
Instance Method Summary collapse
-
#initialize(vm, ns, stream, printer = nil) ⇒ Runner
constructor
A new instance of Runner.
- #print(val) ⇒ Object
- #run ⇒ Object
Methods inherited from Evaluator
#compile_and_eval, #evaluate, #pre_compile, #precompile, #quote
Constructor Details
Instance Method Details
#print(val) ⇒ Object
78 79 80 |
# File 'lib/nydp/runner.rb', line 78 def print val @printer.puts val if @printer end |
#run ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/nydp/runner.rb', line 82 def run res = Nydp.NIL while !@tokens.finished expr = @parser.expression(@tokens) unless expr.nil? begin print(res = evaluate(expr)) rescue Exception => e puts e. e.backtrace.each do |b| puts b end end end end res end |