Stupid brainfuck interpreter.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples
lib
test
README.md
Rakefile
rbf.gemspec

README.md

RBF - Ruby BrainFuck

Yay, birthday, dragon book, let's code.

With this thingy you can parse and evaluate brainfuck and brainfuck-like languages, you can define your own syntax (aka aliases) to use as a brainfuck language.

This is the default syntax:

{ 
  :forward  => '>',
  :backward => '<',

  :increase => '+',
  :decrease => '-',

  :output => '.',
  :input  => ',',

  :while_start => '[',
  :while_end   => ']' 
}

And this is a custom syntax:

{ 
  :forward  => '!!!!',
  :backward => 'ASD',

  :increase => 'XD',
  :decrease => 'LOL',

  :output => 'PLS',
  :input  => 'CMQ',

  :while_start => '[',
  :while_end   => ']' 
}

You can also run brainfuck sources or run a brainfuck repl, just use the rbf binary.

Examples

require 'rbf'

RBF.parse('++[.]')                              # => ["+", "+", ["."]]
RBF.parse('XD XD [PLS]', RBF::Syntax::Nintendo) # => ["+", "+", ["."]]

RBF['++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.'] # => "Hello World!\n"