Brainfuck code generation

From Esolang
Jump to navigation Jump to search

This article presents known methods for representing brainfuck code in more readable forms and for generating brainfuck code from other languages.

Many schemes for representing and/or generating brainfuck code exist. They range from simple substitution macros to compilers from other languages. This page gathers a listing of such schemes together in one place.

Macro systems

Languages that compile to brainfuck


  • Frans Faase's Brainfuck interpreter in Brainfuck was generated using this C program
  • Using Artificial Intelligence to Write Self-Modifying/Improving Programs generates Brainfuck by using a genetic algorithm in C#
  • ELVM Compiler Infrastructure is similar to LLVM but dedicated to Esoteric Languages; "frontends" are used to compile fron a source language into an intermediate representation, which is then used by "backends" to generate code for a target (esoteric) language. The only frontend available uses 8cc, a subset of C, while there are numeorus backeds, including one to compile to brainfuck.
  • FuckBench is a development pipeline under Windows to generate and compile brainfuck code from several languages. It uses an emulator for the Motorola 6502 CPU written in FuckBrainfuck, so that any compiler that targets the 6502 CPU can be used to generate brainfuck code. Currently it supports generating code from FuckBrainfuck, 6502 assembly, C and Java, making available for the first time advanced programming constructs such as object-oriented programming, exceptions and multi-threading for generating brainfuck code.