Brainfuck to sed compiler, written entirely in sed
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
brainfuck2sed.sed

README.md

brainfuck2sed

Brainfuck to POSIX sed compiler written entirely in POSIX sed

Usage notes

brainfuck2sed.sed <prog.b >prog.sed && chmod +x prog.sed && ./prog.sed

brainfuck2sed output scripts use the unary numeral system for I/O (the , and . brainfuck commands) with each number (byte/cell) on a separate line. For instance, a classic "Hello World!" brainfuck program transcompiled with brainfuck2sed would output:

111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111
1111111111

The first line has 72 1s. ASCII character number 72 is H. The second line is 101 = e, third line 108 = l etc. To get ASCII output, you could pipe the output through awk '{printf "%c",length}'.