Giter VIP home page Giter VIP logo

brainfuck's Introduction

Brainfuck

These are some of mine implementations of the Brainfuck programming language in the form of interpreters.

Why?

It happens to be a really good way to acquire a shallow grasp of a programming language, make comparisons.

It contains const, variables, maps, list, stacks, vector, bit fiddling, if-else-switch, output, file reading, error treatment, usage of standard libraries, etc.

So, implementing a brainfuck interpreter is fun and gives you a quick and basic overview of any language you want to learn.

Implementations

Python

python3 brainfuck.py <program>

C

cc brainfuck.c -o brainfuck

./brainfuck <program>

C++

clang++ brainfuck.cpp -o brainfuck

./brainfuck <program>

Go

go run brainfuck.go <program>

Javascript (Node)

node brainfuck.js <program>

Test programs


See programs folder.

Not mine, scraped from the Internets.

Some tech notes


Brainfuck is simple.

Memory use to be 30.000 cells with byte size initialized to zero.

There is a pointer pointing to one of the cells anytime.

Canonical Brainfuck programs are limited to these operands: < > + - , . [ ]

< > moves the pointer along the memory.

+ - increment, decrements the cell values.

. print the character pointed by pointer.

, input (not implemented in my interpreters yet)

[ if memory[pointer] is zero jump to the matching ] position.

] if memory[pointer] is NOT zero return to the matching [ position.

That's all. There are variants: wrapping memory, extended operants, cell size, etc. Almost all unchallenging.

brainfuck's People

Contributors

deibit avatar

Watchers

 avatar  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.