GithubHelp home page GithubHelp logo

onion108 / brainfuck-in-langs Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 64 KB

Brainfuck interpreter in different programming languages.

Makefile 1.47% Brainfuck 0.26% C 23.22% Shell 0.05% D 16.57% Rust 20.02% Go 14.29% C++ 24.11%

brainfuck-in-langs's Introduction

Brainfuck Interpreters In Different Programming Language

This project contains Brainfuck interpreters written in different programming languages. Continue reading to learn more about this idea.

What's Brainfuck?

Brainfuck is an esoteric programming language which has only eight instructions and has been proved to be Turing complete. That means any programming language that is Turing complete can be use to implement a Brainfuck interpreter, and a programming language that can be used to implement a Brainfuck interpreter is Turing complete. Brainfuck is simple. The eight instructions are shown as below with descriptions:

+: Add the value in the pointed slot by one.
-: Substract the value in the pointed slot by one.
<: Substract the pointer by one (i.e. move the pointer to the previous memory slot)
>: Add the pointer by one (i.e. move the pointer to the next memory slot)
[: If the value in the pointed slot is zero, jump past the matching bracket.
]: If the value in the pointed slot isn't zero, jump back the matching bracket.
.: Output the pointed slot.
,: Read input and set it to the pointed slot.

An example program could be found in /c/examples/hello.bf.

Why Brainfuck?

In my personal opinion, writing a Brainfuck interpreter is a good practice to learn a programming language. It is not too complicated to understand and also requires many programming skills that will be used in developing other applications as well. Also, if someone who has learned some programming languages wants to learn a new programming language, reading the source code a Brainfuck interpreter in that language should help him quickly become familiar with that progrmaming language.

Restrictions

We take the C language version as the standard (source code could be found in /c). Any interpreter in this repository must behave like the C version, that includes keeping the following behaviors the same:

  • Command-line argument format;
  • Help message;
  • The output when given the same input;

The error message could be different.

When writing a interpreter in the programming language, you must write the interpreter entirely in that progrmaming language, not just translate the C version into that or port the C version to that programming language. You should entirely rewrite it, and use features in that progrmaming language. You should make the source code typical in that progrmaming language, not a C-style source code in other programming languages.

The name of the binary must be <language name or commonly-used abbreviation>bfi, where <language name or commonly-used abbreviation> should be replaced with the name of the language (in lower case) or the commonly used abbreviation for it (in the lowercase as well), like jsbfi for JavaScript version, rsbfi for Rust version, cppbfi for C++ version, etc.

TODO

The following interpreter will be implemented by the author of this repository, any programming language that aren't in the list is open for pull requests. Any content in this repository (including pull requests that are ready for merging) must satisfy the restrictions.

  • C
  • D
  • Rust
  • Go
  • C++
  • Java
  • Swift

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.