GithubHelp home page GithubHelp logo

spacecase123 / brainfuck Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabianishere/brainfuck

0.0 0.0 0.0 849 KB

Brainfuck interpreter written in C

License: Apache License 2.0

C 92.53% CMake 7.47%

brainfuck's Introduction

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

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

brainfuck's People

Contributors

aliclubb avatar alok avatar boweiliu avatar durka avatar fabianishere avatar jalmari91 avatar outis avatar rien333 avatar rotartsi82 avatar saket-upadhyay avatar sevenbits avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.