Class: Interpreter

Inherits:
Object
  • Object
show all
Defined in:
lib/toylang/interpreter/interpreter.rb

Instance Method Summary collapse

Constructor Details

#initializeInterpreter

Returns a new instance of Interpreter.



7
8
9
# File 'lib/toylang/interpreter/interpreter.rb', line 7

def initialize
  @parser = Parser.new
end

Instance Method Details

#eval(code) ⇒ Object



11
12
13
# File 'lib/toylang/interpreter/interpreter.rb', line 11

def eval(code)
  @parser.parse(code).eval(Runtime)
end