Skip to content

bnjjo/bfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfc

Naive implementation of a brainfuck to x86-64 GNU assembly compiler.

Installation

Important

Please note that this is only compatible with Linux systems using an AMD64 processor.
GCC is also required to assemble and link the compiled output!

Install GCC if you haven't already:

For Debian-based distros:

sudo apt install gcc

For Arch-based distros:

sudo pacman -S gcc

Once you have done that:

  1. Download the precompiled binary in the Releases page
  2. Mark it as executable:
chmod +x bfc
  1. (Optionally) move it to your PATH:
sudo mv bfc /usr/local/bin  # system-wide
mv bfc ~/.local/bin         # per-user

Usage

bfc input.bf output
./output

or in one line:

bfc input.bf output && ./output

Building from source

git clone https://github.com/bnjjo/bfc.git
cd bfc
cargo build --release
./target/release/bfc input.bf output

Examples & credit

I have included a few fun brainfuck programs in the examples directory of this repo. Some of which are:

  • ascii.bf – Prints all 256 standard + extended ASCII characters
  • btc.bf by Katie Ball – A brainfuck to C interpreter
  • cat.bf – A simple cat program, copies stdin to stdout (i.e. writes out whatever you input)
  • hanoi.bf by Clifford Wolf – A towers of Hanoi problem simulation
  • helloworld.bf by Katie Ball – You can guess what this one does lol
  • mandelbrot.bf by Erik Bosman – A mandelbrot set fractal viewer

If you're interested in learning more about brainfuck check out this well-written tutorial by Katie Ball (the person who made the brainfuck to C interpreter and helloworld program!)

About

Brainfuck to x86-64 GNU assembly compiler

Resources

License

Stars

Watchers

Forks

Languages