Brainfuck Interp & Eval

By sizzlemctwizzle Last update Feb 28, 2009 — Installed 67 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
Script Summary:
Interprets Brainfuck source code and evalutates its javascript equivalent
Version: 1.0.3

This script has no discussions.

start the discussion

Review Summary
5 stars
1 reviews (1)
4 stars
0 reviews (0)
3 stars
0 reviews (0)
2 stars
0 reviews (0)
1 star
0 reviews (0)

this script has 1 review

Description

It is with great joy that I present Userscripts.org the ground-breaking Brainfuck development environment for Greasemonkey. If you are anything like me, when a great idea for a new program pops into your head, Brainfuck is your first language of choice to implement your amazing idea. Unfortunately, most current compilers are crude and inconvenient. However, with a interpreter in Greasemonkey, Brainfuck heaven is just a click away. And with a language like Brainfuck, you'll need ALL the extra time you can get.

How to use

To enter Brainfuck code just click on the Greasemonkey icon and select the "User Script Commands..." submenu and click "Run Brainfuck code". A prompt will popup for you to enter your code. After you click "Ok" you will be prompted for an input. Finally, once you click "Ok" again, your code will be interpreted and evaluated and your output will be displayed(providing your code works). Next the javascript equivalent of your code will be displayed, along with an error if one has occurred.

Development features as rich as language itself

  • Enter source - enter your Brainfuck code into the beautiful GUI
  • Input - Give your code the text it can read
  • Output - The text returned by your code
  • Produced Javascript - Learn more about Brainfuck by seeing your code in its equivalent javascript form. Unlike many other interpreters the resulting code is slightly less redundant.

Current Limitations

Freezed by very large complex scrips. There will always be limitations to a interpreter written in an already interpreted language. If you want to do anything really serious(with Brainfuck?) then I suggest you find a more optimized compiler. This is intended to be a simple, light-hearted, learning tool.

Command support

My interpreter supports all 8 of the Brainfuck commands:
  • ">" = increase data point by one
  • "<" = decrease data point by one
  • "+" = increase the value at the current data point by one
  • "-" = decrease the value at the current data point by one
  • "." = output the value at the current data point
  • "," = replace the value of the current data point with an input value
  • "[" = jump forward past the matching "]" if the value of the current data point is zero
  • "]" = jump backward to the matching "[" if the value of the current data point is not zero

Simple Examples

Reverse the input
+[>,]<-[+.<-]
Repeat the input
,[.,]
Output "Hello World!"
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
ROT13(okay so it's really not simple, but I like to show off that I can run it!)
+[,+[-[>+>+<<-]>[<+>-]+>>++++++++[<-------->-]<-[<[-]>>>+[<+<+>>-]<[>+<-]<[<++>>>+[<+<->>-]<[>+<-]]>[<]<]>>[-]<<<[[-]<[>>+>+<<<-]>>[<<+>>-]>>++++++++[<-------->-]<->>++++[<++++++++>-]<-<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<<<<+>>>>++++[<++++++++>-]>-]<<-<-]>[<<<<[-]>>>>[<<<<->>>>-]]<<++++[<<++++++++>>-]<<-[>>+>+<<<-]>>[<<+>>-]+>>+++++[<----->-]<-[<[-]>>>+[<+<->>-]<[>+<-]<[<++>>>+[<+<+>>-]<[>+<-]]>[<]<]>>[-]<<<[[-]<<[>>+>+<<<-]>>[<<+>>-]+>------------[<[-]>>>+[<+<->>-]<[>+<-]<[<++>>>+[<+<+>>-]<[>+<-]]>[<]<]>>[-]<<<<<------------->>[[-]+++++[<<+++++>>-]<<+>>]<[>++++[<<++++++++>>-]<-]>]<[-]++++++++[<++++++++>-]<+>]<.[-]+>>+<]>[[-]<]<]