Home > rbf

rbf

Rbf is a project mainly written in Ruby, it's free.

Stupid brainfuck interpreter.

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"
Previous:ffmpeg-android