A more-or-less complete implementation of brainfuck in C++17.
- running programs from files or stdin
- program code and input as one string (using ! to separate code from data)
- hex memory dump on demand (using # in bf code)
- wrapping
- fixed or elastic ("infinite") memory
- setting the starting point in memory
- optional logging on each step of execution (if compiled with logging support)
$ git clone --recurse-submodules https://github.com/godexsoft/bF
- cxxopts (submodule, header-only)
- libfmt (submodule, header-only)
The project is configured and built using CMake.
Logging is disabled by default but can be enabled using BF_ENABLE_LOG cmake option:
$ cmake -DBF_ENABLE_LOG=ON ..
To configure and build bF:
$ mkdir build && cd build && cmake ..
$ make
By default this will build bF in Release configuration.
$ ./bF -h
There is an examples folder with a bunch of programs to play with. You can either specify the file as first argument or as --input option:
$ ./bF ../examples/hello.bf
$ ./bF --input ../examples/hello3.bf -i 10
or read input from stdin if no filename is specified
$ ./bF < ../examples/hello.bf
$ echo ',[.,]!Hello' | ./bF