- Notifications
You must be signed in to change notification settings - Fork76
Brainfuck interpreter written in C
License
fabianishere/brainfuck
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Brainfuck interpreter written in C.
brainfuck [-veh] file...-e --evalrun code directly-v --versionshow version information-h --helpshow a help message.
The interactive console can be accessed by passing no arguments.
We also provide a C api:
#include<stdio.h>#include<stdlib.h>#include<brainfuck.h>intmain() {BrainfuckState*state=brainfuck_state();BrainfuckExecutionContext*context=brainfuck_context(BRAINFUCK_TAPE_SIZE);BrainfuckInstruction*instruction=brainfuck_parse_string(",+++++.");brainfuck_add(state,instruction);brainfuck_execute(state->root,context);brainfuck_destroy_context(context);brainfuck_destroy_state(state);returnEXIT_SUCCESS;}
Theexamples/ directory contains a large amount ofbrainfuck example programs. We have tried to attribute the originalauthors of these programs where possible.
Download the source code by running the following code in your command prompt:
$ git clone https://github.com/fabianishere/brainfuck.git
or simplygrab a copy of the source code as a Zip file.
Create the build directory.
$ mkdir build$cd build
Brainfuck requires CMake and a C compiler (e.g. Clang or GCC) in order to run. It also depends onlibedit, which is available in the main repositories of most Linux distributions (e.g. aslibedit-dev on Debian/Ubuntu) and comes with the macOS XCode command line tools.Then, simply create the Makefiles:
$ cmake ..
and finally, build it using the building system you chose (e.g. Make):
$ make
After the build has been finished, you may install the binaries to your local system (seeCMAKE_INSTALL_PREFIX for information about the install prefix):
$ make install
Alternatively, you may run the interpreter directly without installation, for instance:
$ ./brainfuck ../examples/hello.bf
The code is released under the Apache License version 2.0. SeeLICENSE.txt.
Fabian Mastenbroek https://github.com/fabianisherealiclubb https://github.com/aliclubbdiekmann https://github.com/diekmannSevenBits https://github.com/SevenBitsAlex Burka https://github.com/durkaoutis https://github.com/outisrien333 https://github.com/rien333boweiliu https://github.com/boweiliuRotartsi https://github.com/ROTARTSI82Saket Upadhyay https://github.com/Saket-Upadhyayoutis https://github.com/outisJalmari91 https://github.com/Jalmari91Alok Singh https://github.com/alokLasse Damsgaard Skaalum https://github.com/humleflue
About
Brainfuck interpreter written in C