abf is a Brainfuck interpreter written in x86-64 Assembly for Linux.
Usage: abf [OPTION] FILE
abf is a brainfuck interpreter written in Assembly.
Options:
-s, --tape-size=NUM The tape size to use (default: 5000)
Change this if your program overflows the default tape size
-v, --verbose Show timing information
The FILE argument must point to a file containing a brainfuck program.
Examples:
Execute a program from stdin:
$ echo "+++++++++++++++++++++++++++++++++.-----------------------." | abf -
Execute a program from a file:
$ abf hello_world.bf
Execute a program from a file with tape size 10000:
$ abf -s 10000 large_tape.bf
Installation should be pretty easy on a normal x86-64 Linux system.
- Clone the repository
git clone https://github.com/xarantolus/asm-bf
- Change to its directory
cd asm-bf - Install to
/usr/bin/abfsudo make install
- Test if the installation worked by running an example program
This should output
echo "+++++++++++++++++++++++++++++++++.-----------------------." | abf -
!and a new line.
Here are some interesting programs you can run with this interpreter.
You can find more interesting programs on brainfuck.org.
And if you want to do something even more interesting, you can just execute 5MB of random (printable) bytes:
cat /dev/urandom | tr -cd "[:print:]\n" | head -c $((5<<20)) | abf -v -
The interpreter source code can be found in bf/bf.S. It directly executes system calls from Assembly and thus does not depend on any libraries to read from stdin/write to stdout. Since output is not buffered and each byte is written individually, writing should be rather slow.
The rest of the program (handling command-line arguments, reading input files etc.) is written in C.
The interpreter does bounds checks to avoid over/underrunning the program string and machine tape (it will show an error message when that happens and terminate safely).
This is free as in freedom software. Do whatever you like with it.