Method: Brainfuck::CodeLoader.execute_file

Defined in:
lib/brainfuck/code_loader.rb

.execute_file(name, compile_to = nil, print = Compiler::Print.new) ⇒ Object

Takes a .bf file name, compiles it if needed and executes it.



23
24
25
26
27
28
29
# File 'lib/brainfuck/code_loader.rb', line 23

def self.execute_file(name, compile_to = nil, print = Compiler::Print.new)
  cm = Compiler.compile_if_needed(name, compile_to, print)
  ss = ::Rubinius::StaticScope.new Object
  code = Object.new
  ::Rubinius.attach_method(:__run__, cm, ss, code)
  code.__run__
end