Class: Crisp::Runtime
- Inherits:
-
Object
- Object
- Crisp::Runtime
- Defined in:
- lib/crisp/runtime.rb
Overview
The Crisp Runtime
Each runtime holds its own environment. All predefined functions are loaded when creating a new runtime. Run code by calling run with the output of the parser as argurment.
Instance Method Summary collapse
-
#initialize(env = nil) ⇒ Runtime
constructor
create a new env and load all functions when creating a new runtime.
-
#run(ast) ⇒ Object
run the parsed code (abstract syntax tree).
Constructor Details
Instance Method Details
#run(ast) ⇒ Object
run the parsed code (abstract syntax tree)
15 16 17 |
# File 'lib/crisp/runtime.rb', line 15 def run(ast) ast.eval(@env) end |