home → code → brainwash

brainwash

Overview

brainwash is an optimizing interpreter for the Brainfuck programming language written in C. It is developed with speed, low memory footprint, functionality and portability in mind.

Some features and/or design details:

Note: As of version 0.3, it is possible to choose between cells of type signed integer and unsigned character (1 byte ranging from 0 to 255) prior to compilation. Please refer to the installation for details on how to do this.

Installation

For gzip (.gz):

$ tar -xvzf brainwash-0.3.tar.gz

For bzip2 (.bz2):

$ tar -xvjf brainwash-0.3.tar.bz2

Change to the source directory:

$ cd brainwash-0.3/src/

For cells of type signed integer (default), issue:

$ make

Alternatively, for cells of type unsigned character, issue:

$ make char

This will create the brainwash executable under the current working directory.

To remove brainwash from your system, issue:

$ make clean

Usage

The output of ./brainwash -h follows:

$ ./brainwash -h
brainwash 0.3
Copyright (c) 2004, 2005, 2006 Aggelos Orfanakos

usage: ./brainwash [options] [file]

options:

  -O         optimize interpretation
  -d [N]     print a memory snapshot of N surrounding cells upon # [11 or less]
  -i <file>  read input from <file>
  -o <file>  write output to <file>
  -V         print version information and exit
  -h         print this help message and exit

License

brainwash is licensed under the terms of the MIT license.

Download

brainwash-0.3.tar.gz (6.41 KiB)

Alternatives

For something significantly smaller and slower, you may want to give (my own) tinybf.rb a try. Other than that, the web is full of Brainfuck compilers and interpreters.