Class: Brainfuck::Stage::BfAST

Inherits:
Rubinius::Compiler::Stage
  • Object
show all
Defined in:
lib/brainfuck/stages.rb

Overview

This stage takes a ruby array as produced by the lexer and produces a tree of Brainfuck::AST nodes.

Instance Method Summary collapse

Constructor Details

#initialize(compiler, last) ⇒ BfAST

Returns a new instance of BfAST.



98
99
100
101
# File 'lib/brainfuck/stages.rb', line 98

def initialize(compiler, last)
  @compiler = compiler
  super
end

Instance Method Details

#runObject



103
104
105
106
107
# File 'lib/brainfuck/stages.rb', line 103

def run
  @output = Brainfuck::Parser.new.apply @input
  pp(@output) if @compiler.parser.print.ast?
  run_next
end