Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Brainfuck interpreter written in C

License

NotificationsYou must be signed in to change notification settings

fabianishere/brainfuck

Repository files navigation

Brainfuck interpreter written in C.

Usage

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;}

Examples

Theexamples/ directory contains a large amount ofbrainfuck example programs. We have tried to attribute the originalauthors of these programs where possible.

Getting the source

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.

Building

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

License

The code is released under the Apache License version 2.0. SeeLICENSE.txt.

Contributors

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

[8]ページ先頭

©2009-2025 Movatter.jp