Introduction
The Brainfuck (BF) programming language is an esoteric programming language that is essentially impossible—or at least highly impractical—to actually write useful programs in. Even if you became a very skilled programmer in…
8 min readTechnical report · Web edition
From a native Brainfuck computer to a typed compiler backend.
Complete overview
Browse the complete web edition, from the Synapse-191 hardware through the Acus compiler backend, reflection, appendices, and references.
The Brainfuck Computer
The Brainfuck (BF) programming language is an esoteric programming language that is essentially impossible—or at least highly impractical—to actually write useful programs in. Even if you became a very skilled programmer in…
8 min readA true BISC implementation is a direct representation of the abstract BF machine described in Section Brainfuck , consisting of an array of memory-cells together with a pointer pointing to one of these cells. The pointer can…
17 min readA control sequence is a sequence of control signals being sent out to various modules on subsequent clock cycles to implement a specific opcode. This chapter will go through each of the control sequences that implement the BF…
21 min readThis chapter will discuss the implementation of each module and the way they integrate together to make the computer. Figure 14 shows the computer as it was in February 2025. The overlays shown in Figure 15 show where each of…
36 min readWhile designing and implementing the computer, several supporting utilities were developed. The assembler ( bfasm ) is responsible for translating BF programs (text) into machine language (binary), the programmer and its…
6 min readIn this chapter we show snapshots of the output during the execution of each of the BF programs listed in Appendix BF Test Suite . Each of these programs was able to run successfully at the maximum clock speed of around 250…
6 min readBrainfuck Compilation
Acus 4 is not a BF compiler: it is a C++ library for the development of such compilers. This chapter is not a guide on how to use Acus. For examples and extensive API details, please visit the GitHub repository at [10] .…
3 min readIn the Acus model, a program consists of a series of basic blocks, sequences of code that are always executed in order, and jumps between those blocks. Each basic block ( B i ) is compiled into its corresponding BF…
6 min readThe data-tape is considered a stack, where each function owns a stack frame. Each frame is composed of slots: a return-slot (if the function returns a value), argument-slots (if the function takes arguments) and local…
19 min readWhenever a variable is declared in Acus, the allocator will look for available space in the current stack-frame. From the allocator’s point of view, named locals, compiler temporaries and cache slots are all typed slots inside…
3 min readBefore discussing larger compiler structures such as caching and dynamic access, it is useful to look at the small Brainfuck idioms from which Acus builds its generated code. Many of the algorithms in this chapter are simple…
18 min readSlot proxies (Section Slot Proxies and Materialization ) allow expressions to remain abstract until their value is needed. However, repeatedly materializing the same proxy can duplicate work. For example, accessing the same…
6 min readThe caching system is one of the optimizations used by Acus to try to somewhat limit the number of generated BF instructions, which tends to grow very fast for complex programs. Even though it was never a goal to produce…
6 min readReflection
This project set out as a “What if?” for which expectations were deliberately kept low. A functional system was the goal; not a fast one. We had no idea what kinds of speeds we could expect, how stable the system would be and…
8 min readGallery
Figure 57. Wire stripping can quickly lead to a mess.
1 min readAppendix
Table 15. Control signals for each of the BF instructions. Instr K V A S Z Cycle Control Signals Any except 0 LD(FBI) “ . ”, “ , ” and “ ? ” + 0 0 1 INC(D) SETV(CU) LD(FA) 0 0 2 INC(IP) CLR(CC) 1 0 1 LD(D) OE(RAM) 1 0 2 INC(D)…
4 min read# This file can be compiled with Mugen, see https://github.com/jorenheit/mugen. [rom] { 8192 x 8 x 3 } [address] { cycle: 3 opcode: 4 flags: K, V, A, S, Z } [signals] { HLT RS0 RS1 RS2 INC DEC CLR_DP EN_SP OE_RAM WE_RAM EN_IN…
6 min readThe following chapter lists all components required to build the Synapse-191 computer, including integrated circuits, passive components, and other hardware parts. The system was constructed entirely on solderless breadboards…
1 min readHello World ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<++++++++++++++ +.>.+++.------.--------.>+.>. Listing 9. hello.bf, [8] Factorial…
1 min readListing 16. ISRs that implement the state machine of the IO module.
1 min readTable 18 lists the factor pair selected for each constant ( c ) from 0 through 128. The generated code first constructs the product ( a b ), then corrects for any remaining difference ( c − a b ) using increment or decrement…
2 min readThis appendix contains the full hardware schematics for the Synapse-191 computer. Each schematic corresponds to a specific module described in Chapter Hardware Implementation of this report, including the Control Unit,…
1 min readReferences
Wikipedia, Brainfuck , https://en.wikipedia.org/wiki/Brainfuck
2 min read