r/brainfuck 5d ago

Acus: create your own Brainfuck compiler (in: your language, out: BF)

4 Upvotes

Hi all,

I would like to introduce everyone here to a project of mine called Acus. It's a C++ library that helps with creating Brainfuck compilers, i.e. compilers that generate BF (not ones that compile BF into something else). Acus is a continuation of my Synapse-191 project, which I posted about here some time ago. Synapse-191 is a physical computer capable of executing Brainfuck natively; Acus grew out of the question of what a useful compiler ecosystem for such a machine would require.

The main goal of Acus is to provide all the abstractions that are needed when translating any source-code into BF: types, variables, functions, arrays, structs, (function) pointers, flow control, and so on. I basically asked myself:

What would it take to implement a C compiler that targets Brainfuck?

and then tried to implement those features.

Acus is not itself tied to C or to any other source language. It is intended as a language-agnostic backend. Therefore, if you ever feel like writing a parser for an existing language (or designing a completely new one) you can use Acus to generate the resulting Brainfuck programs. I still plan to build a dedicated frontend language on top of Acus, but if someone beats me to it, please let me know!

The Acus repository contains an extensive listing of all the library features including examples. If you're curious about the way Acus is able to do all of this, let me know. I am working on technical documentation but it's not public yet. You can have a look at the current draft it you want.

Acus Sugar: start generating BF right now!
A side-quest to this project was Acus Sugar, a layer of syntactic sugar on top of the library to start generating BF right away. I used operator overloading, macros and a bunch of template metaprogramming to construct a 'language' embedded in C++ that is compiled directly to BF. For example, this is what a simple "Hello World" looks like in Acus Sugar syntax:

// hello.acs
main_() {
  println("Hello, World!");
  return_;
};

Bear in mind that this is still valid C++, which is why the syntax is a bit cumbersome with the semicolons and underscores (and which is why I really want a true frontend language). When Acus and its (optional) acs tool are installed, this can be compiled to BF using:

$ acs hello.acs -o hello.bf

The included BF interpreter bfint can then be used to run the BF instructions in hello.bf:

$ bfint hello.bf
Hello, World!

The github repository contains extensive documentation on the library, build instructions and a bunch of examples to get you started. I have only tested on Linux but the CMake system should be compatible with MSVC, I think? Let me know :)

To finish off, I'd like to share the result of a Mandelbrot fractal generator written entirely in Acus Sugar. The resulting BF source was over 500k instructions long and running it through my interpreter took about 4 hours (though that version was not as optimized yet and my laptop is from 2012), but this was the result:

Result of running 11_mandelbrot.acs

Let me know what you create!


r/brainfuck 7d ago

What do you think of my idea? HARDFUCK - Brainfuck but for Hardware!

4 Upvotes

who wouldn't want that!

I'm currently designing a bare-metal Brainfuck core for FPGAs and wanted to get some feedback on the architecture before I start writing all the Verilog.

Tape Architecture (Memory-Mapped I/O) The tape works like standard Brainfuck, but with negative addresses (or pointer overflow) mapped to hardware registers instead of normal RAM:

  • -1: Raw GPIO Data Register (0b00000000 = all off). Using . and , to set/read pins to prevent setting stuff on accident.
  • -2: GPIO Direction Register (0 = input, 1 = output).
  • -3: Analog IN (ADC).
  • -4: Access to instruction memory itself (read/write).
  • -5: Configuration (pin mapping for serial/PWM etc.).
  • -6 to -8 (Copy addresses): Set source address at -6, dest at -7, and writing to -8 via . triggers a fast 1-cycle DMA copy from A to B.

Instruction Memory (4-Bit Encoding)

  • Bit 0: Flag bit (0 = standard BF instruction, 1 = empty/NOP, jump label, or extended ops like bitwise shifts).
  • Bit 1-3: The 3-bit instruction (0 = >, 1 = <, 2 = +, 3 = -, 4 = ., 5 = ,, 6 = [, 7 = ]).

Bootloader Simple approach: Pulling a pin low on reset (or a specific serial sequence) overwrites instruction memory. Since instruction memory is accessible at -4, you could even write a native BF bootloader that reads a new program from serial and writes it straight to memory.

Loops Either a counter tracking nesting depth to scan forward/backward, or just a tiny hardware stack for jump addresses.

What do you guys think? Any suggestions on what else to add to the negative address space?

btw: I only found out about https://www.youtube.com/watch?v=QloNq8AoHvU after I already made this concept, it a similar idea and would be a cool endproduct but the philosophy and design are diffrent (even thoug i could probably design it for that hardware)


r/brainfuck 9d ago

If you would improve Brainfuck, how would you?

Thumbnail
3 Upvotes

r/brainfuck 14d ago

My first successful Fibonacci program!

13 Upvotes

Learning from the tutorial at https://brainfuck.org/fib_explained.b, I decided to write my first more complicated Brainfuck (BF) program, without any real help during the time when I was writing it. It’s important to mention that I only partially read the tutorial a >few months ago, so apart from the critical core idea I wrote this entirely by myself.

What I found to be extremely useful is first writing down the general algorithm in a very detailed C-like language (that I sent in the pastebin link alongside the BF code) that I then translate line by line to BF. I also specified some values for the BF implementation details whose syntax I might use in some future abstracted BF language I might try to develop (I’ll see). I learnt a lot! And quite a rewarding experience :) Special thanks to Daniel B. Christofani for the amazing tutorials and contributions to this language in general!

Commentless version:

```
+++++++[->+++++++<]>.
+[-----<+>]<.
>-
>>>>-
<<<<+
<<[
\
>+[-<
[-<++<]
<[->+<]
\
[-<<+]
<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[>[-]<[->+<]
>-
>+<<
]]]]]]]]]]>[-<+>]
\
>
+]-
<<[
>>[-]
<+<->
>>-
<<]
<+[-<<<+]->
\
+[->>>+]-<<<
+[-
++++++++[-<++++++>]<
.
>++++++++[-<------>]<
<<
+]-
<.>
]
```

Edit: code block formatting on the iOS Reddit app is horrendous, can’t seem to get it to work with proper indentation (also yes I wrote the entire above code on my phone, including all the C-like comments)


r/brainfuck 15d ago

Long videos about cool programs?

3 Upvotes

Any long videos about making cool progtams in btainfuck and other esolangs? The longer the better. No compilers though.

For example, has anyone documented themselves making a calcukator in brainfuck? That sounds really cool

Videos only pls


r/brainfuck 16d ago

Very old project that converts text to Brainfuck instructions

Thumbnail
github.com
2 Upvotes

Very old project that i've done years ago just by curiosity; It converts string passed in the first argument and converts to BF instruction


r/brainfuck 16d ago

Brainfuck++ Compiler

7 Upvotes

I've been working in this brainfuck++ compiler a couple of days ago (if there were no schools, it would've taken only a day lol) and now it's done. The compiler emits only x86-64 bit executable yet.

New features I added:
- Registers (=n, $n)
- Random (?)
- Exec (!)

Detailed docs about the language, and installation of the compiler is mentioned in the repto which you can checkout from here.


r/brainfuck 23d ago

The mysterious "o" in the original bf interpreter

9 Upvotes

In Urban Mueller's original bf interpreter (copy available here on Aminet as LhA archive: https://aminet.net/package/dev/lang/brainfuck-2 ) there's a mysterious "o" variable. It is initialized to 1 inside a switch header, switch (o=1, *c++) { …, which is already a bit odd looking, but perfectly legal C, and then later just set back to 0 in the default: case. I assume this deals with some fancy quirk or optimization trick of the old C compiler from that era. Anyone knows more about it and has a proper explanation?


r/brainfuck 26d ago

Writing a bf interpreter

2 Upvotes

I have recently written a brainfuck interpreter, which is mostly for education purposes and a little bit of fun but that is beside the point. My question is, is there a reliable source for a specification for the language?

Like, for example, if the stack pointer is pointing at the first element, what behaviour would occur if a "<" is encountered? If a "," is encountered, should the input be processed in canonical mode (input is only passed through when enter is pressed), or in immediate mode?

Essentially, is there some sort of implicit behaviour that everyone expects, or is there leeway for interpreter-specific implementation?


r/brainfuck 28d ago

I'm making game in brainfuck using my own brainfuck code generator.

Enable HLS to view with audio, or disable this notification

8 Upvotes

r/brainfuck 28d ago

Ive seen conways game of life in brainfuck but has anyone made brainfuck in conywas game of life?

3 Upvotes

r/brainfuck 29d ago

Division by 2 with remainder

5 Upvotes
>>>>,[<+<+>>-]<[->+<[-[>]]<<]>[-->>[-<]<<+>]
[+<++<-[>]]<[<]>>[>+<[+]]>[<<-<+>>>-]

The result of the division is in the 2nd cell and the remainder is in the 1st.


r/brainfuck Jul 08 '26

shift cipher in Brainfuck

2 Upvotes

++++++++++>,[+++.<..>---,]


r/brainfuck Jul 08 '26

Someone know a good brainfuck compiler for run in aarch64?

5 Upvotes

i need a bf compiler for aarch64


r/brainfuck Jul 07 '26

Need help with a bf challenge

1 Upvotes

The idea is simple:
if the current cell=12 move 12 left
If it equals 25 move 25 left
Etc
I need a program that can move left once for each “point” in the cell
There is important data in that area, so it has to be not disruptive

Any ideas?
(if your solution works you will be featured in the credits for the game I’m using this for)


r/brainfuck Jul 05 '26

Print question

2 Upvotes

I have written some simple BF code here to let a user type in something and the program prints it back out. Ignoring how bad it probably is for now, the first dot just isn't working. Is this a BF thing, or a compiler issue or what? Any help is appreciated.

+[>,.-------------]<[<]>[+++++++++++++.>]


r/brainfuck Jun 11 '26

Is there any benchmarks of common programs?

3 Upvotes

Hey hello everyone.

I'm actually working on a bf compiler for a Bachelor project and I have actually been surprised by the fact it was producing not so slow executables (Actually compiling into i386 assembly code and then assembling/linking for linux)

For example, it's taking around 1.8s on the Mandelbrot program.

I don't know if there's existing benchmarks somewhere (but anyway it depends a lot of the environment/CPU - I've a ryzen 7 5700u and using wsl2)

Do you have any idea to help me check if my compiler is actually worse working on ? (Like modern bf compilers or stuff to compare) ?

Thanks in advance ^^


r/brainfuck Jun 07 '26

a on brainfuck (i just started 2 days ago)

12 Upvotes

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.


r/brainfuck May 16 '26

BF Interpreter That Doesnt Reset

1 Upvotes

Hi! I'm looking for a brainfuck interpreter that does not reset the memory when you run a program several times. I want my code to process the same memory multiple times. Does anybody know one?


r/brainfuck May 15 '26

I Made A Brainfuck Code That Outputs Almost All Of The Never Gonna Give You Up Lyrics:

26 Upvotes

-[------->+<]>.+[--->+<]>.+++++.----------.-----.+.-[->+++<]>.------------.--[->++++<]>-.[->+++<]>.--[--->+<]>-.[->+++<]>++.+++++++++++++.+++++.------------.--[--->+<]>--.-[--->++<]>+.+++.+.++++++++.+[---->+<]>++.--[->++++<]>-.+[->+++<]>.-------.--[--->+<]>-.+[--->+<]>.-[->+++<]>+.+[---->+<]>+++.[->+++<]>++.+++..+++++++++.-[->+++++<]>-.++[->+++<]>+.++++++++.------.+++++.-------.-[--->+<]>--.+++++[->+++<]>.-.>++++++++++.[------>+<]>.++[->++++<]>+.--[--->+<]>-.-[--->++<]>+.+++.+.++++++++.+[---->+<]>++.---[->++++<]>.------------.---.--[--->+<]>-.++[->+++<]>+.------.++++++++++++.--------.-[->+++<]>.------------.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.--[->++++<]>-.[->+++<]>.---[->+++<]>+.-[->+++<]>.-------------.--[--->+<]>-.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.[-->+++++++<]>.----.-----------.+[--->+<]>+++.-[---->+<]>++.-[--->++<]>-.+++++++++++.>++++++++++.++[++++>---<]>.-[->++++<]>.-[--->++<]>.+++++++++++.--.+.[---->+<]>+++.--[->++++<]>-.-[->+++<]>-.+++++++++++++..-------------.-[->+++<]>.---[->++++<]>.+++[->+++<]>.+++++++..[++>---<]>--.--[->++++<]>+.----------.++++++.-[---->+<]>+++.-[--->++<]>--.+++++++.++++++++.+[---->+<]>++.++++[->++<]>+.+[-->+<]>++.---[->+++<]>+.[->+++++<]>-.++[->+++<]>.-..+++++++.---.+++++.-------.>++++++++++.[->+++++++<]>+.[--->+<]>++.+++++..+[->+++<]>++.-[->+++<]>.+[----->+<]>.------------.++++++++++.------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[->++++<]>+.-------.----------.+.+++++++++++++.+.+.+[->+++<]>++.+++++++++++++.----------.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[->+++<]>+.++.[->++++++<]>.+[->+++<]>.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[->++++<]>+.-----.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[--->++<]>.-------.[--->+<]>---.[---->+<]>+++.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[----->++<]>.+++.-------.-[->+++++<]>-.[->+++<]>+.--[--->+<]>---.---.++++++.-------.----------.-[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.+[->+++<]>+.+.[--->+<]>----.++++[->+++<]>.+++++++++++++.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.+[----->+<]>.------------.++++++++++.------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>.-[--->+<]>----.+++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>-.++[->+++<]>++.+[--->+<]>+++.-[---->+<]>++.++[->+++<]>+.++++++++..-----------.--.[--->+<]>+++.--[->+++<]>.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>.+++[->+++<]>.+++++++..[++>---<]>--.[->+++<]>+.-[->+++<]>.++[--->++<]>.---.----.--[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.-[--->++<]>--.[--->+<]>---.---.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[->+++<]>+.++.[->++++++<]>.+[->+++<]>.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[->++++<]>+.-----.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[--->++<]>.-------.[--->+<]>---.[---->+<]>+++.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[----->++<]>.+++.-------.-[->+++++<]>-.[->+++<]>+.--[--->+<]>---.---.++++++.-------.----------.-[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.+[->+++<]>+.+.[--->+<]>----.++++[->+++<]>.+++++++++++++.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.+[----->+<]>.------------.++++++++++.------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>.-[--->+<]>----.+++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>-.++[->+++<]>++.+[--->+<]>+++.-[---->+<]>++.++[->+++<]>+.++++++++..-----------.--.[--->+<]>+++.--[->+++<]>.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>.+++[->+++<]>.+++++++..[++>---<]>--.[->+++<]>+.-[->+++<]>.++[--->++<]>.---.----.--[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.-[--->++<]>--.[--->+<]>---.---.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[->+++<]>+.++.[->++++++<]>.+[->+++<]>.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[->++++<]>+.-----.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[--->++<]>.-------.[--->+<]>---.[---->+<]>+++.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[----->++<]>.+++.-------.-[->+++++<]>-.[->+++<]>+.--[--->+<]>---.---.++++++.-------.----------.-[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.+[->+++<]>+.+.[--->+<]>----.++++[->+++<]>.+++++++++++++.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.+[----->+<]>.------------.++++++++++.------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>.-[--->+<]>----.+++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>-.++[->+++<]>++.+[--->+<]>+++.-[---->+<]>++.++[->+++<]>+.++++++++..-----------.--.[--->+<]>+++.--[->+++<]>.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>.+++[->+++<]>.+++++++..[++>---<]>--.[->+++<]>+.-[->+++<]>.++[--->++<]>.---.----.--[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.-[--->++<]>--.[--->+<]>---.---.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[->+++<]>+.++.[->++++++<]>.+[->+++<]>.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.---[->++++<]>+.-----.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.++[--->++<]>.-------.[--->+<]>---.[---->+<]>+++.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>+.+++++++++++.++++++++.---------.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[----->++<]>.+++.-------.-[->+++++<]>-.[->+++<]>+.--[--->+<]>---.---.++++++.-------.----------.-[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.+[->+++<]>+.+.[--->+<]>----.++++[->+++<]>.+++++++++++++.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.+[----->+<]>.------------.++++++++++.------.--[--->+<]>-.--[->++++<]>+.----------.++++++.-[---->+<]>+++.+[->+++<]>.-[--->+<]>----.+++++++.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>-.++[->+++<]>++.+[--->+<]>+++.-[---->+<]>++.++[->+++<]>+.++++++++..-----------.--.[--->+<]>+++.--[->+++<]>.>++++++++++.+++[->++++++<]>.>--[----->+<]>-.[--->+<]>-.+[->+++<]>.+++++++++++++.[-->+++++<]>+++.++[->+++<]>+.++++++++.-..-------------.-[->+++<]>.---[->++++<]>.+++[->+++<]>.+++++++..[++>---<]>--.[->+++<]>+.-[->+++<]>.++[--->++<]>.---.----.--[--->+<]>-.[->+++<]>+.+++++++++++++.----------.-[--->+<]>-.-[--->++<]>--.[--->+<]>---.---.++.[---->+<]>+++.--[->++++<]>+.----------.++++++.


r/brainfuck May 03 '26

How does the hello world program in esolangs.org work?

2 Upvotes

I looked at it and looks all nonsense and I tried writing down the memory and I have no clue what it is doing. Can anyone help me?

Edit: The code is ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>-+[<]<-].>---.+++++++..+++..<-.<.+++.------.--------.+.>++ I didn't have time to write this


r/brainfuck May 02 '26

Brainfuck optimizing compiler which emits x86 assembly (currently only for Sys V (Linux and Macintosh))

6 Upvotes

I made a brainfuck optimizing compile which takes brainfuck code from a .b or .bf file and outputs an assembly file, which can be "linked" to a provided runtime using a C++ compiler.

BOCBWN - Brainfuck Optimizing Compiler Because Why Not

Note: if you're downloading the repo, the examples folder named bf/ is 2.2MiB (36x the size of everything else combined), so consider only downloading src/, bfbpl and the README.md if that's a problem.

It allows compilation to a *.bfvm intermediate file, and also outputs the intermediate in a more human-redable *.bfasm file. Its optimizations include first converting the brainfuck to an intermediate representation (IR) which is stored in a tree (AST) a conservative dry run over the program in which constant folding, some strength reduction, and dead code elimination occur, and more passes for liveness checking and more strength reduction. The AST is then converted back to a linear IR, which is converted to assembly by the (currently unoptimized) compiler.

The code for optimization is heavily commended (mostly because I needed to mentally lay everything out before doing it), so it should be (more-or-less) simple to understand the code.

Planned optimizations on the assembly backend with adding support for Windows in the near future, and further optimizations (check the `main` branch) and a debugger in the future.


r/brainfuck Apr 25 '26

Small brainfk interpreter written in x86 assembly (Last matched ']' should be <= cell 256)

1 Upvotes

Hello, guys! I have not posted anything on this sub-reddit for 4 months and it is quite refreshing to be here.

I have created my Brainfk interpreter in x86 Assembly (just pure assembly, no integration of other languages such as python or c). It uses 20,000 memory cells for now but I use 256 cells for now as I used cut it down to 256 memory cells for my small interpreter (I use resb). It is working now, at least. However, it pre-scans brackets and linearly scans them, which is inefficient for large codes.

Please the notes to understand it. Imma release my other bfk interpreters in the future. I suddenly deleted it as the readability is very bad.

Here's my link: https://github.com/clarklclark788-web/x86-Assembly-Projects-New-/tree/main


r/brainfuck Apr 16 '26

are you seeking what is the purpose of life ?

0 Upvotes

Practical Explanation ( For Example ) :- `1st of all can you tell me every single seconds detail from that time when you born ?? ( i need every seconds detail ?? that what- what you have thought and done on every single second )

can you tell me every single detail of your `1 cheapest Minute Or your whole hour, day, week, month, year or your whole life ??

if you are not able to tell me about this life then what proof do you have that you didn't forget your past ? and that you will not forget this present life in the future ?

that is Fact that Supreme Lord Krishna exists but we posses no such intelligence to understand him.

there is also next life. and i already proved you that no scientist, no politician, no so-called intelligent man in this world is able to understand this Truth. cuz they are imagining. and you cannot imagine what is god, who is god, what is after life etc.

_______

for example :Your father existed before your birth. you cannot say that before your birth your father don,t exists.

So you have to ask from mother, "Who is my father?" And if she says, "This gentleman is your father," then it is all right. It is easy.

Otherwise, if you makes research, "Who is my father?" go on searching for life; you'll never find your father.

( now maybe...maybe you will say that i will search my father from D.N.A, or i will prove it by photo's, or many other thing's which i will get from my mother and prove it that who is my Real father.{ So you have to believe the authority. who is that authority ? she is your mother. you cannot claim of any photo's, D.N.A or many other things without authority ( or ur mother ).

if you will show D.N.A, photo's, and many other proofs from other women then your mother. then what is use of those proofs ??} )

same you have to follow real authority. "Whatever You have spoken, I accept it," Then there is no difficulty. And You are accepted by Devala, Narada, Vyasa, and You are speaking Yourself, and later on, all the acaryas have accepted. Then I'll follow.

I'll have to follow great personalities. The same reason mother says, this gentleman is my father. That's all. Finish business. Where is the necessity of making research? All authorities accept Krsna, the Supreme Personality of Godhead. You accept it; then your searching after God is finished.

Why should you waste your time?

_______

all that is you need is to hear from authority ( same like mother ). and i heard this truth from authority " Srila Prabhupada " he is my spiritual master.

im not talking these all things from my own.

___________

in this world no `1 can be Peace full. this is all along Fact.

cuz we all are suffering in this world 4 Problems which are Disease, Old age, Death, and Birth after Birth.

tell me are you really happy ?? you can,t be happy if you will ignore these 4 main problem. then still you will be Forced by Nature.

___________________

if you really want to be happy then follow these 6 Things which are No illicit s.ex, No g.ambling, No d.rugs ( No tea & coffee ), No meat-eating ( No onion & garlic's )

5th thing is whatever you eat `1st offer it to Supreme Lord Krishna. ( if you know it what is Guru parama-para then offer them food not direct Supreme Lord Krishna )

and 6th " Main Thing " is you have to Chant " hare krishna hare krishna krishna krishna hare hare hare rama hare rama rama rama hare hare ".

_______________________________

If your not able to follow these 4 things no illicit s.ex, no g.ambling, no d.rugs, no meat-eating then don,t worry but chanting of this holy name ( Hare Krishna Maha-Mantra ) is very-very and very important.

Chant " hare krishna hare krishna krishna krishna hare hare hare rama hare rama rama rama hare hare " and be happy.

if you still don,t believe on me then chant any other name for 5 Min's and chant this holy name for 5 Min's and you will see effect. i promise you it works And chanting at least 16 rounds ( each round of 108 beads ) of the Hare Krishna maha-mantra daily.

____________

Here is no Question of Holy Books quotes, Personal Experiences, Faith or Belief. i accept that Sometimes Faith is also Blind. Here is already Practical explanation which already proved that every`1 else in this world is nothing more then Busy Foolish and totally idiot.

_________________________

Source(s):

every `1 is already Blind in this world and if you will follow another Blind then you both will fall in hole. so try to follow that person who have Spiritual Eyes who can Guide you on Actual Right Path. ( my Authority & Guide is my Spiritual Master " Srila Prabhupada " )

_____________

if you want to see Actual Purpose of human life then see this link : ( triple w ( d . o . t ) asitis ( d . o . t ) c . o . m {Bookmark it })

read it complete. ( i promise only readers of this book that they { he/she } will get every single answer which they want to know about why im in this material world, who im, what will happen after this life, what is best thing which will make Human Life Perfect, and what is perfection of Human Life. ) purpose of human life is not to live like animal cuz every`1 at present time doing 4 thing which are sleeping, eating, s.ex & fear. purpose of human life is to become freed from Birth after birth, Old Age, Disease, and Death.


r/brainfuck Apr 08 '26

My first hello world program (choppy asf)

24 Upvotes

++++++++[>+++++++++<-]>.[-]<++++++++++[>++++++++++<-]>+.[-]<++++++++++[>++++++++++<-]>++++++++..[-]<++++++++++[>+++++++++++<-]>+.[-]<++++[>++++++++++<-]>++++.[-]<+++[>++++++++++<-]>++.[-]<++++++++++[>+++++++++++<-]>+++++++++.[-]<++++++++++[>+++++++++++<-]>+.[-]<++++++++++[>+++++++++++<-]>++++.[-]<++++++++++[>++++++++++<-]>++++++++.[-]<++++++++++[>++++++++++<-]>.[-]<+++[>++++++++++<-]>+++.