• Stars
    star
    535
  • Rank 82,940 (Top 2 %)
  • Language
    C
  • License
    Apache License 2.0
  • Created about 13 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Brainfuck interpreter written in C

brainfuck Build Status

Brainfuck interpreter written in C.

Usage

brainfuck [-veh] file...
-e --eval	run code directly
-v --version	show version information
-h --help	show 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>
    
int main() {
	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);
	return EXIT_SUCCESS;
}

Examples

The examples/ directory contains a large amount of brainfuck example programs. We have tried to attribute the original authors 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 simply grab 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 on libedit, which is available in the main repositories of most Linux distributions (e.g. as libedit-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 (see CMAKE_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. See LICENSE.txt.

Contributors

Fabian Mastenbroek https://github.com/fabianishere
aliclubb https://github.com/aliclubb
diekmann https://github.com/diekmann
SevenBits https://github.com/SevenBits
Alex Burka https://github.com/durka
outis https://github.com/outis
rien333 https://github.com/rien333
boweiliu https://github.com/boweiliu
Rotartsi https://github.com/ROTARTSI82
Saket Upadhyay https://github.com/Saket-Upadhyay
outis https://github.com/outis
Jalmari91 https://github.com/Jalmari91
Alok Singh https://github.com/alok
Lasse Damsgaard Skaalum https://github.com/humleflue

More Repositories

1

pam_reattach

Reattach to the user's GUI session on macOS during authentication (for Touch ID support in tmux)
C
683
star
2

udm-iptv

Helper tool for configuring routed IPTV on the UniFi Dream Machine (Pro)
Shell
423
star
3

pve-edge-kernel

Newer Linux kernels for Proxmox VE 7
Shell
370
star
4

udm-kernel-tools

Tools for bootstrapping custom kernels on the UniFi Dream Machine
Shell
327
star
5

udm-kernel

Custom Linux kernels for the UniFi Dream Machine
C
128
star
6

boot2flappy

Flappy Bird as bootable UEFI executable
Assembly
62
star
7

kotlin-plugin-generated

A Kotlin compiler plugin that annotates Kotlin-generated methods for improved coverage reports
Kotlin
35
star
8

brainfuck-java

Interpreter for the original Brainfuck language and its derivatives written in Java.
Java
31
star
9

booklab

Visually recognize the books on your shelf!
Kotlin
23
star
10

udm-unlock

Unlock write-protected disks on the UniFi Dream Machine Pro
C
20
star
11

kexec-mod

Kexec as loadable kernel module for Linux ARM64 kernels
C
16
star
12

jsamp

Library for the Grand Theft Auto San Andreas Multiplayer query mechanism written in Java.
Java
6
star
13

broccoli

A modern vision on the 90's game Log!cal
Java
5
star
14

formula-andy

Formula One Manager written in Java
Java
5
star
15

ktor-oauth2

OAuth2 authorization framework for Ktor
Kotlin
5
star
16

traceur

Raytracing engine written in C++
C++
5
star
17

shadevolution

Genetic Programming for Shader Simplification
Python
4
star
18

hugetable

Re-implementation of Google BigTable in Scala
Scala
4
star
19

logging.js

Lightweight logging library for Node.js based on the java.util.logging library.
JavaScript
4
star
20

nitrogen

Lightweight web framework written in PHP
PHP
4
star
21

sas

Simple streaming audio server in C
C
4
star
22

kaffee

Kaffee is a software project management tool similar to Maven and is written in Coffeescript.
CoffeeScript
4
star
23

edx

Solutions for online courses
F#
4
star
24

slf4n

Simple logging facade for NodeJS allowing the end user to choose the desired logging framework at deployment time.
JavaScript
3
star
25

iconsync

A tool to sync your icon theme on macOS
Swift
3
star
26

udm-shims

Shims for the proprietary kernel modules on the UniFi Dream Machine (Pro)
C
3
star
27

homebrew-personal

Personal Homebrew recipes that are not (yet) available in the official Homebrew repositories
Ruby
3
star
28

trufflephp

GraalVM implementation of the PHP language (WIP)
Kotlin
2
star
29

olympiad

Solutions for the problems of the Dutch Olympiad of Informatics.
Python
2
star
30

vdom.js

Rebuilding React from scratch
JavaScript
2
star
31

kmbridge

In-kernel IGMP Proxy for Linux (WIP)
C
1
star
32

glimpse

Small OpenGL wrapper for modern C++
C++
1
star
33

fastauction

Auctions with Budget Constraints
Kotlin
1
star