brainwash project is an open source interpreter for the Brainfuck programming language, written in ANSI C.
Implementation-specific details:
· The array has no bounds; this makes the pointer able to move towards both left and right "infinitely".
· Since each cell holds a signed integer value, cell values can be negative.
· Cell values are initialized to 0 (zero).
· A cell will assume its minimum/maximum value if it is already at its maximum/minimum value and a + / - command is executed respectively.
· Cell values are left intact when executing a , command after the end of input.
· Characters other than the eight Brainfuck commands are considered to be comments and are thus ignored. This, with the exception of ! and # that sometimes act as commands and other times don't (comments).
· When both the program code and its input are read from stdin, ! is (a command) used to separate them.
· When the -d option is used, # is (a command) used to print, to stderr, a memory snapshot of the surrounding cells (useful for debugging).
brainwash is distributed under the terms of the 2-clause revised BSD license which is available in its LICENSE file.
Installation
For gzip:
$ tar -xzvf brainwash-0.2.tar.gz
For bzip2:
$ tar -xjvf brainwash-0.2.tar.bz2
Then:
$ cd brainwash-0.2/
$ gcc brainwash.c -o brainwash
This will create the brainwash binary under the current working directory.
Usage
By invoking brainwash with the -h option, the following help message is printed:
$ ./brainwash -h
brainwash 0.2 (2005-02-05)
Usage: ./brainwash [-t] [-d width] [-i file] [-o file] [file | -]
./brainwash -h
./brainwash -V
-t Time interpretation.
-d width Print the memory snapshot of the width - 1 surrounding cells upon '#'.
-i file Read the input from file.
-o file Write the output to file.
file Read the program from file.
- Read the program from standard input (default).
-h Print this help message and exit.
-V Print version information and exit.
What's New in This Release:
· Licensed under the MIT license.
· Standardized the use of temporary files.
· Made unsigned character cells possible by issuing `make char` instead of
· `make` during installation.
· Removed the -t option (not accurate).
· Made the argument of the -d option to default to 11 or less.
· Made the array finite at the left.
· Made the program to ignore a possible shebang line to allow executable
· Brainfuck programs.
· Implemented optimization (suggested by Jon Ripley) through the -O option.
Product's homepage