github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

agorf / tinybf

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A minuscule interpreter for the Brainfuck programming language, written in Ruby — Read more

  Cancel

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Also output the unit 
agorf (author)
Sun Jan 24 01:19:15 -0800 2010
commit  d2c602f045e1408c0165065db668c2b8686262e3
tree    b75b59e1a0fb8ce15e3cb0752c9ccac375e21e78
parent  a22691ab25a33f88aa56f5eb2eb16ba6f90ef638
tinybf /
name age
history
message
file README.markdown Loading commit data...
file size.rb
directory test/
file tinybf.rb
README.markdown

tinybf

A minuscule interpreter for the Brainfuck programming language, written in Ruby.

Some of the features/design decisions:

  • Matches and caches brackets before executing code, speeding up the interpretation.
  • Has an array of 1-byte unsigned cells that can grow "infinitely" to the right.
  • Wraps cell values if they exceed the minimum/maximum allowed.
  • Ignores a < command if the array pointer is on the left-most cell.
  • Passes Daniel Cristofani's tests and follows his Epistle to the Implementors closely.
  • Weighs only 382 bytes!

Usage

Apart from the eight standard Brainfuck commands, the first exclamation mark (!) is significant and is used to tell apart the program being interpreted from its input.

Here's a usage example with Daniel Cristofani's numwarp.b:

>>>>+>+++>+++>>>>>+++[>,+>++++[>++++<-]>[<<[-[->]]>[<]>-]<<[>+>+>>+>+[<<<<]<+>>[
+<]<[>]>+[[>>>]>>+[<<<<]>-]+<+>>>-[<<+[>]>>+<<<+<+<--------[<<-<<+[>]>+<<-<<-[<<
<+<-[>>]<-<-<<<-<----[<<<->>>>+<-[<<<+[>]>+<<+<-<-[<<+<-<+[>>]<+<<<<+<-[<<-[>]>>
-<<<-<-<-[<<<+<-[>>]<+<<<+<+<-[<<<<+[>]<-<<-[<<+[>]>>-<<<<-<-[>>>>>+<-<<<+<-[>>+
<<-[<<-<-[>]>+<<-<-<-[<<+<+[>]<+<+<-[>>-<-<-[<<-[>]<+<++++[<-------->-]++<[<<+[>
]>>-<-<<<<-[<<-<<->>>>-[<<<<+[>]>+<<<<-[<<+<<-[>>]<+<<<<<-[>>>>-<<<-<-]]]]]]]]]]
]]]]]]]]]]]]>[>[[[<<<<]>+>>[>>>>>]<-]<]>>>+>>>>>>>+>]<]<[-]<<<<<<<++<+++<+++[[>]
>>>>>>++++++++[<<++++>++++++>-]<-<<[-[<+>>.<-]]<<<<[-[-[>+<-]>]>>>>>[.[>]]<<[<+>
-]>>>[<<++[<+>--]>>-]<<[->+<[<++>-]]<<<[<+>-]<<<<]>>+>>>--[<+>---]<.>>[[-]<<]<]
!1337
      /\
        \
    /\
     /\
  /\  /
   /\
 \  /
  \

In the example above, 1337 is the input to the interpreted program (everything before the !).

Limitations

  • Insanely slow compared to a C implementation.
  • No error checking (e.g. unmatched brackets).
  • Both a program's code and its input are passed through the same stream (stdin); this makes I/O non-interactive.
  • The code is obfuscated and unreadable.

License

The MIT License

Copyright (c) 2010 Aggelos Orfanakos

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author

Aggelos Orfanakos, http://agorf.gr/

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server