Class: Interpreter
- Inherits:
-
Object
- Object
- Interpreter
- Defined in:
- lib/toylang/interpreter/interpreter.rb
Instance Method Summary collapse
- #eval(code) ⇒ Object
-
#initialize ⇒ Interpreter
constructor
A new instance of Interpreter.
Constructor Details
#initialize ⇒ Interpreter
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 |