Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Brainfuck compiler, not interpreter.

Project description

bfcom

A compiler for the (joke) language BrainFuck

Bfcom is a very simple compiler which aims to compile standardized brainfuck. That is, it only seeks to compile features integral to what brainfuck is normally known for. For this reason, this compiler will not be adding in any other features.

It works by emulating memory using arrays. For instance, if I want to advance one address, I would just type > and it would effectively translate to i++; in C. This means that the pointer is now pointing to the next array element, effectively emulating memory, which brainfuck requires.

char array[memory_size];
char* i = &array;

For a comparison of brainfuck to C, see this list below:

"> : i++;" "< : i--;" "+ : (*i)++;" "-: (*i)--;"

The compiler uses Python to loop through a brainfuck file, then it translates to C. Other options within the compiler (or, rather, shall I be calling it: the translator) can use GCC to compile it.

This is nothing really special or grandiose, but it can be useful for testing and experimental purposes, if you do not want to use a JavaScript version of brainfuck. However, this program was only made as an experiment, and thus will not be updated.

To install, simply look inside the install.sh file first to ensure safety and run it. It will be installed to /usr/bin, where you can easily access it.

Or, if you prefer a package manager... pip install bfcom

To use, you simply run the bfcom, with the filename of the .bf file, and with the arguments that come with it. For example, you can run ~ bfcom file.bf --compile file.o to compile a .bf file to an .o file using gcc.

Project details


Release history Release notifications

This version

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bfcom, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size bfcom-1.0.0-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page