An open API service indexing awesome lists of open source software.

https://github.com/amaan-bhati/brainfk

This repo explores Brainfuck, a quirky language with just 8 characters! It includes a Rust interpreter that translates Brainfuck code to Rust, a C interpreter that converts Brainfuck to C code, and even an experimental x86 assembly compiler for Brainfuck. These are just for fun and entertainment purpose.
https://github.com/amaan-bhati/brainfk

Last synced: about 1 month ago
JSON representation

This repo explores Brainfuck, a quirky language with just 8 characters! It includes a Rust interpreter that translates Brainfuck code to Rust, a C interpreter that converts Brainfuck to C code, and even an experimental x86 assembly compiler for Brainfuck. These are just for fun and entertainment purpose.

Awesome Lists containing this project

README

          

# Brainfuck Playground: A fun Dive into Esoteric Computing
This repository is your one-stop shop for exploring Brainfuck, an esoteric programming language that pushes the boundaries of minimalism. With only eight characters (+, -, <, >, [, ], . and ,), Brainfuck allows for surprisingly complex computations. Here, we delve into three projects that dissect Brainfuck in various ways, all for educational and entertainment purposes:

# 1. Brainfuck to Rust Interpreter

What it Does: This Rust program acts as a translator, taking Brainfuck code as input and transforming it into a functionally equivalent Rust program.
Benefits:
Understand how Brainfuck instructions map to actual code in a higher-level language like Rust.
See the generated Rust program and gain insights into how Brainfuck logic translates into more traditional programming constructs.
Experiment by running Brainfuck programs through the generated Rust code.

# 2. Brainfuck to C Interpreter

What it Does: This project leverages the C programming language to interpret Brainfuck code.
Benefits:
Gain a different perspective on Brainfuck by observing how it's interpreted within the C language.
Compare and contrast the generated C code with the Rust program from the previous project.
Explore how Brainfuck concepts are expressed in another widely used language.
3. Experimental x86 Assembly Brainfuck Compiler (WIP)

What it Does: This project (still under development) pushes the boundaries even further by aiming to compile Brainfuck code directly into x86 assembly language.
Benefits (For the Adventurous):
Dive deep into how Brainfuck instructions translate directly to machine code.
Gain a deeper understanding of computer architecture and how instructions are executed at the hardware level.
Explore the low-level world of assembly language and its connection to Brainfuck.
The Power of Simplicity in Brainfuck

While Brainfuck may not be your go-to language for everyday programming, it serves as a captivating example of achieving computational power with minimal resources. By examining how these projects translate Brainfuck into other languages, you gain a valuable understanding of:

How computers execute instructions at a fundamental level.
The underlying principles of programming languages.
The fascinating world of esoteric computing where unconventional approaches push the boundaries of what's possible.
Embrace the Exploration!

# Getting Started with Brainfuck

Before diving into the code itself, let's take a quick look at Brainfuck's core concepts:

Memory Model: Brainfuck utilizes a simple linear memory model represented as an array of cells, typically initialized to zeros.
Data Pointer: A data pointer points to the currently active cell in the memory.
Instruction Set: Brainfuck boasts a mere eight instructions:
+: Increments the value at the current cell.
-: Decrements the value at the current cell.
<: Moves the data pointer one cell to the left.
>: Moves the data pointer one cell to the right.
[: Starts a loop that continues until the value at the current cell is zero.
]: Ends the loop, jumping back to the corresponding [.
.: Outputs the value at the current cell as an ASCII character.
,: Reads an ASCII character from user input and stores it in the current cell.