Module: SyntaxTree::Bf::Evaluate

Defined in:
lib/syntax_tree/bf/evaluate.rb

Defined Under Namespace

Classes: Compiler, Machine

Class Method Summary collapse

Class Method Details

.run(source, stdin: STDIN, stdout: STDOUT) ⇒ Object



104
105
106
107
108
109
110
# File 'lib/syntax_tree/bf/evaluate.rb', line 104

def self.run(source, stdin: STDIN, stdout: STDOUT)
  node = Parser.new(source).parse
  compiler = Compiler.new

  compiler.visit(node)
  Machine.new(compiler.insns, stdin: stdin, stdout: stdout).run
end