RubyGems Navigation menu

brainfucktt 0.1.0

# Brainfucktt A [Brainfuck][brainfuck] interpreter built in [Ruby][ruby] using [Treetop][treetop]. Brainfuck is an eight-instruction turing-clomplete programming language created in 1993 by Urban Müller, based on the more formal programming language [P′′][p''] created by Corrado Böhm in 1964. It is designed to challenge and amuse programmers, and is not made to be suitable for practical use. ## Install ### Bundler: `gem 'brainfucktt'` ### RubyGems: `gem install brainfucktt` ## Brainfuck Instructions `>` Increment the data pointer (to point to the next cell to the right). `+++++++>++++++++++>+++>+++.>+.+++++++..+++.>++..+++.------.--------.>+.>.' Brainfucktt.run(code) ``` ### Parsing ```ruby require 'brainfucktt' # "Hello World!" written in Brainfuck code = '++++++++++[>+++++++>++++++++++>+++>+++.>+.+++++++..+++.>++..+++.------.--------.>+.>.' parser = Brainfucktt.parse(code) # Print out the AST of the code p parser.tree # Run the code within Ruby parser.run ``` ### StringIO Sometimes you do now want to use STDIN or STDOUT for the I/O of the Brainfuck program. To do that, you must use the stdlib `stringio`: ```ruby require 'brainfucktt' require 'stringio' # "Hello World!" written in Brainfuck code = '++++++++++[>+++++++>++++++++++>+++>+++.>+.+++++++..+++.>++..+++.------.--------.>+.>.' output = StringIO.new Brainfucktt.run(code, output: output) p output.string # => "Hello World!\n" ``` ## Copyright Copyright © 2012 Ryan Scott Lewis . The MIT License (MIT) - See LICENSE for further details. [brainfuck]: http://www.muppetlabs.com/~breadbox/bf/ [ruby]: http://ruby-lang.org [treetop]: http://treetop.rubyforge.org [p'']: http://en.wikipedia.org/wiki/P%E2%80%B2%E2%80%B2

Versions:

  1. 0.1.2 - December 6, 2012 (12 KB)
  2. 0.1.1 - December 6, 2012 (10 KB)
  3. 0.1.0 - December 6, 2012 (11.5 KB)

Authors:

  • Ryan Scott Lewis

Owners:

5815438e3cb72c2e4104e835861f26b2

Sha 256 checksum:

16ca55a1b7bc93f56f1c89d40f6b8e55c320a727681c86078e58e6f3b922c933

Total downloads 3,577

For this version 1,127

Required Ruby Version: None

Licenses:

N/A

Gemfile:
= Copy to clipboard Copied!

install:
= Copy to clipboard Copied!

Links: