lib/turmali/interpreter.rb in turmali-0.0.3 vs lib/turmali/interpreter.rb in turmali-0.0.4

- old
+ new

@@ -1,11 +1,11 @@ -require "turmali/parser" +require "turmali/runtime/bootstrap" require "turmali/runtime/object" require "turmali/runtime/method" require "turmali/runtime/context" require "turmali/runtime/class" -require "turmali/runtime/bootstrap" +require "turmali/parser" class Interpreter def initialize @parser = Parser.new end @@ -120,7 +120,16 @@ if condition.eval(context).ruby_value body.eval(context) else Constants["nil"] end + end +end + +class WhileNode + def eval(context) + while @condition.eval(context).ruby_value + @body.eval(context) + end + Constants["nil"] end end \ No newline at end of file