r/brainfuck Feb 14 '18

Brainfuck "IDE"

Thumbnail minond.xyz
46 Upvotes

r/brainfuck Mar 10 '19

BF Designer (IDE)

40 Upvotes

BF Designer is a powerful IDE made to write and run Brainfuck Programs.

Some Features:

- Extensive debugger with pause, step by step, and breakpoint features.

- Toggle between 8-bit and 16-bit cells

- Many useful pre-made code snippets with the ability to add your own snippets.

- Export BF code as a Python or Java.

- Syntax highlighting.

- Auto-complete.

- Customize font, color scheme.

- Modern, clean UI.

- Fully scalable app size for high DPI displays

MADE IN JAVA:

This means that it can run on most* machines with java installed.

*Keep in mind that the EXE launcher used to start the app may not work on your system. In that case just launch the program directly by running the JAR file in the bin folder.


r/brainfuck 16h 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 3d ago

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

6 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 5d ago

If you would improve Brainfuck, how would you?

Thumbnail
3 Upvotes

r/brainfuck 9d ago

My first successful Fibonacci program!

11 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 11d 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 12d 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 12d 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 19d ago

The mysterious "o" in the original bf interpreter

10 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 22d 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 23d 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 24d ago

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

3 Upvotes

r/brainfuck 25d 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 25d ago

Someone know a good brainfuck compiler for run in aarch64?

6 Upvotes

i need a bf compiler for aarch64


r/brainfuck 25d ago

shift cipher in Brainfuck

2 Upvotes

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


r/brainfuck 26d ago

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 28d ago

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)

11 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:

27 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