Class: Esolang::Interpreters::BaseInterpreter
- Inherits:
-
Object
- Object
- Esolang::Interpreters::BaseInterpreter
- Defined in:
- lib/interpreters/base_interpreter.rb
Overview
The BaseInterpreter class provides a common interface and basic functionality for interpreting esoteric programming languages.
Instance Method Summary collapse
-
#initialize(code) ⇒ BaseInterpreter
constructor
Initializes a new instance of the BaseInterpreter class.
-
#run ⇒ Object
abstract
Executes the interpretation of the code.
Constructor Details
#initialize(code) ⇒ BaseInterpreter
Initializes a new instance of the BaseInterpreter class.
11 12 13 14 15 16 |
# File 'lib/interpreters/base_interpreter.rb', line 11 def initialize(code) @code = code.chars @code_pointer = 0 @loop_map = create_loop_map @tape_pointer = 0 end |
Instance Method Details
#run ⇒ Object
This method is abstract.
Subclasses must implement the run method.
Executes the interpretation of the code. Subclasses must implement this method.
22 23 24 |
# File 'lib/interpreters/base_interpreter.rb', line 22 def run raise NotImplementedError, 'Subclasses must implement the run method' end |