Trivial brainfuck substitution

From Esolang
Jump to navigation Jump to search

TrivialBrainfuckSubstitution is not a single programming language, but rather a large family of programming languages that are trivial substitutions of the brainfuck language.

Syntax

We will pick TrivialBrainfuckSubstitution("a","b","c","d","e","f","g","h") as an example. To write a program in TrivialBrainfuckSubstitution("a","b","c","d","e","f","g","h"), first make a program in brainfuck. Then, convert it to according to this table:

Brainfuck Substitution Argument Description
> a Move the pointer to the right
< b Move the pointer to the left
+ c Increment the memory cell under the pointer
- d Decrement the memory cell under the pointer
. e Output the character signified by the cell at the pointer
, f Input a character and store it in the cell at the pointer
[ g Jump past the matching h if the cell under the pointer is 0
] h Jump back to the matching g

In addition it's common to replace short sequences of brainfuck instructions with substitutions. For example [-] may be replaced by a single instruction or some form of run length encoding might be used.

Example Members of the TrivialBrainfuckSubstitution family

Language Trivial brainfuck Substitution
!!Fuck TrivialBrainfuckSubstitution("!!!!!#", "!!!!!!#", "!!!!!!!#", "!!!!!!!!#", "!!!!!!!!!!#", "!!!!!!!!!#", "!!!!!!!!!!!#", "!!!!!!!!!!!!#")
AAA TrivialBrainfuckSubstitution("aAaA", "AAaa", "AAAA", "AaAa", "aaaa", "aAaa", "aaAA", "aaaA")
Alphuck TrivialBrainfuckSubstitution("a", "c", "e", "i", "j", "o", "p", "s")
BrainFNORD TrivialBrainfuckSubstitution("pineal", "fnord", "hail", "eris", "kallisti", "chaos", "23", "5")
brainfuck TrivialBrainfuckSubstitution(">", "<", "+", "-", ".", ",", "[", "]")
brainfuck 4 humans TrivialBrainfuckSubstitution("right", "left", "incr", "decr", "out", "inp", "loop(", ")")
brainsymbol TrivialBrainfuckSubstitution("!", "@", "#", "$", "%", "^", "&", "*")
Broccosprout TrivialBrainfuckSubstitution("Plant some broccoli seeds. $", "Plant some brussels sprouts seeds. $", "Water the broccoli and brussels sprouts. $", "Vernalize the broccoli and brussels sprouts. $", "Pollinate the broccoli and brussels sprouts. Take the male flower, rub it lightly with a paintbrush, and move the pollen to the female flower. $", "Wait for the broccoli and brussels sprouts to form the seed pods $", "Separate the seed from the chaff. $", "Plant the broccosprout seeds and jump with excitement! $")
Btjzxgquartfrqifjlv TrivialBrainfuckSubstitution("f", "rqi", "qua", "rtf", "lv", "j", "btj", "zxg")
Binaryfuck TrivialBrainfuckSubstitution("010", "011", "000", "001", "100", "101", "110", "111")
Blub TrivialBrainfuckSubstitution("Blub. Blub?", "Blub? Blub.", "Blub. Blub.", "Blub! Blub!", "Blub! Blub.", "Blub. Blub!", "Blub! Blub?", "Blub? Blub!")
Brainfuck, but every + is replaced with the bee movie script TrivialBrainfuckSubstitution(">", "<", [Too long to be put in this page, full link here.], "-", ".", ",", "[", "]")
Brainfuck² TrivialBrainfuckSubstitution("Ook!", "Alphuck", "Fuckfuck", "POGAACK", "Unibrain", "Wordfuck", "Brainfuck²", "ZZZ")
Colonoscopy TrivialBrainfuckSubstitution(";};", ";{;", ";;};", ";;{;", ";;;};", ";;;{;", "{{;", "}};")
DetailedFuck TrivialBrainfuckSubstitution("MOVE THE MEMORY POINTER ONE CELL TO THE RIGHT", "MOVE THE MEMORY POINTER ONE CELL TO THE LEFT", "INCREMENT THE CELL UNDER THE MEMORY POINTER BY ONE", "DECREMENT THE CELL UNDER THE MEMORY POINTER BY ONE", "REPLACE THE CELL UNDER THE MEMORY POINTER'S VALUE WITH THE ASCII CHARACTER CODE OF USER INPUT", "PRINT THE CELL UNDER THE MEMORY POINTER'S VALUE AS AN ASCII CHARACTER", "IF THE CELL UNDER THE MEMORY POINTER'S VALUE IS ZERO INSTEAD OF READING THE NEXT COMMAND IN THE PROGRAM JUMP TO THE CORRESPONDING COMMAND EQUIVALENT TO THE ] COMMAND IN BRAINFUCK", "IF THE CELL UNDER THE MEMORY POINTER'S VALUE IS NOT ZERO INSTEAD OF READING THE NEXT COMMAND IN THE PROGRAM JUMP TO THE CORRESPONDING COMMAND EQUIVALENT TO THE [ COMMAND IN BRAINFUCK")
ExampleFuck TrivialBrainfuckSubstitution("Truth Machine", "Quine", "Hello World", "Cat Program", "Self Interpreter", "Polyglot", "FizzBuzz", "99 Bottles of Beer")
FJ TrivialBrainfuckSubstitution("jfj", "jff", "fff", "ffj", "fjj", "fjf", "jjf", "jjj")
Fluffle Puff TrivialBrainfuckSubstitution("b", "t", "bf", "pl", "!", "?", "*gasp*", "*pomf*")
fuckbeEs TrivialBrainfuckSubstitution("f", "u", "c", "k", "b", "e", "E", "s")
GERMAN TrivialBrainfuckSubstitution("LINKS", "RECHTS", "ADDITION", "SUBTRAKTION", "EINGABE", "AUSGABE", "SCHLEIFENANFANG", "SCHLEIFENENDE")
GibMeRol TrivialBrainfuckSubstitution("G", "i", "b", "M", "e", "R", "o", "l")
HTPF TrivialBrainfuckSubstitution(">", "<", "=", "/", """, "#", "&", ";")
Human's mind have sex with someone TrivialBrainfuckSubstitution("Move the pointer to the right", "Move the pointer to the left", "Increment the memory cell under the pointer", "Decrement the memory cell under the pointer", "Output the character signified by the cell at the pointer", "Input the character signified by the cell at the pointer", "Jump past the matching right bracket if the cell under the pointer is 0", "Jump back to the matching left bracket if the cell under the pointer is not 0")
K-on Fuck TrivialBrainfuckSubstitution("うんうんうん", "うんうんたん", "うんたんうん", "うんたんたん", "たんうんうん", "たんうんたん", "たんたんうん", "たんたんたん")
Lazyfuck TrivialBrainfuckSubstitution("e", "t", "a", "n", "s", "r", "o", "i")
Mierda TrivialBrainfuckSubstitution("Derecha", "Izquierda", "Mas", "Menos", "Decir", "Leer", "Iniciar Bucle", "Terminar Bucle")
Morsefuck TrivialBrainfuckSubstitution(".--", "--.", "..-", "-..", "-.-", ".-.", "---", "...")
Nagawooski TrivialBrainfuckSubstitution("na", "ga", "woo", "ski", "an", "ag", "oow", "iks")
Omam TrivialBrainfuckSubstitution("hold your horses now", "sleep until the sun goes down", "through the woods we ran", "deep into the mountain sound", "don't listen to a word i say", "the screams all sound the same", "though the truth may vary", "this ship will carry")
Ook! TrivialBrainfuckSubstitution("Ook. Ook?", "Ook? Ook.", "Ook. Ook.", "Ook! Ook!", "Ook! Ook.", "Ook. Ook!", "Ook! Ook?", "Ook? Ook!")
PenisScript TrivialBrainfuckSubstitution("8=D", "8==D", "8===D", "8====D", "8=====D", "8======D", "8=======D", "8========D")
Pewlang TrivialBrainfuckSubstitution("pew", "Pew", "pEw", "peW", "PEw", "pEW", "PeW", "PEW")
Pikalang TrivialBrainfuckSubstitution("pipi", "pichu", "pi", "ka", "pikachu", "pikapi", "pika", "chu")
ReverseFuck TrivialBrainfuckSubstitution("<", ">", "-", "+", ",", ".", "]", "[")
Revolution 9 TrivialBrainfuckSubstitution("It's alright", "turn me on, dead man", "Number 9", "if you become naked", "The Beatles", "Paul is dead", "Revolution 1", "Revolution 9")
Redundant TrivialBrainfuckSubstitution("The first 5000 digits of pi>", "The first 5000 digits of pi<", "The first 5000 digits of pi+", "The first 5000 digits of pi-", "The first 5000 digits of pi.", "The first 5000 digits of pi,", "The first 5000 digits of pi[", "The first 5000 digits of pi]")
Roadrunner TrivialBrainfuckSubstitution("meeP", "Meep", "mEEp", "MeeP", "MEEP", "meep", "mEEP", "MEEp")
Scratch is dumb TrivialBrainfuckSubstitution("\x05", "\x04", "\x00", "\x01", "\x03", "\x02", "\x06", "\x07")
SCREAMCODE TrivialBrainfuckSubstitution("AAAH", "AAAAGH", "FUCK", "SHIT", "!!!!!!", "WHAT?!", "OW", "OWIE")
Spider Giant TrivialBrainfuckSubstitution("Spider", "He is our hero!", "We love you spider!", "Get rid of", "Must stop!", "Step on Spider!", "I promise not to kill you.", "Oh!")
Ternary TrivialBrainfuckSubstitution("01", "00", "11", "10", "21", "20", "02", "12")
THIS IS NOT A BRAINFUCK DERIVATIVE TrivialBrainfuckSubstitution("IT NEVER WAS", "IT NEVER WILL BE", "THIS IS NOT A BRAINFUCK DERIVATIVE", "IT HAS NOTHING TO DO WITH BRAINFUCK", "TO ANYBODY WHO SAYS THIS IS A BRAINFUCK DERIVATIVE:", "FUCK YOU", "SHUT UP YOU LITTLE BITCH", "SHUT THE FUCK UP")
Triplet TrivialBrainfuckSubstitution("001", "100", "111", "000", "010", "101", "110", "011")
UndetailedFuck TrivialBrainfuckSubstitution("DON'T MOVE THE MEMORY POINTER ONE CELL TO THE RIGHT", "DON'T MOVE THE MEMORY POINTER ONE CELL TO THE LEFT", "DON'T INCREMENT THE CELL UNDER THE MEMORY POINTER BY ONE", "DON'T DECREMENT THE CELL UNDER THE MEMORY POINTER BY ONE", "DON'T REPLACE THE CELL UNDER THE MEMORY POINTER'S VALUE WITH THE ASCII CHARACTER CODE OF USER INPUT", "DON'T PRINT THE CELL UNDER THE MEMORY POINTER'S VALUE AS AN ASCII CHARACTER", "IF THE CELL UNDER THE MEMORY POINTER'S VALUE IS ZERO INSTEAD OF READING THE NEXT COMMAND IN THE PROGRAM DON'T JUMP TO THE CORRESPONDING COMMAND EQUIVALENT TO THE ] COMMAND IN BRAINFUCK", "IF THE CELL UNDER THE MEMORY POINTER'S VALUE IS NOT ZERO INSTEAD OF READING THE NEXT COMMAND IN THE PROGRAM DON'T JUMP TO THE CORRESPONDING COMMAND EQUIVALENT TO THE [ COMMAND IN BRAINFUCK")
UwU TrivialBrainfuckSubstitution("OwO", "°w°", "UwU", "QwQ", "@w@", ">w<", "~w~", "¯w¯")
wepmlrio TrivialBrainfuckSubstitution("r", "l", "p", "m", "o", "I", "w", "e")
ZZZ TrivialBrainfuckSubstitution("zz", "-zz", "z", "-z", "zzz", "-zzz", "z+z", "z-z")
⫸fuck TrivialBrainfuckSubstitution("⫸", "⫷", "⁜", "⌁", "⁕", "⁑", "⟬", "⟭")
脑操 TrivialBrainfuckSubstitution("》", "《", "十", "一", "。", ",", "(", ")")
脑子爆掉 TrivialBrainfuckSubstitution("右", "左", "上", "下", "写", "读", "始", "终")

There are of course, infinitely many members not listed here.

Interpreter

Interpreters for these languages are also generally trivial to write using a regular expression and a lookup table to convert the language to something that can be executed directly. Two simple examples are below.

Ruby Perl
#!/usr/bin/env ruby
eval 'm=Hash.new(p=0);'+ARGF.read.gsub(/./,
     '>' => 'p+=1;',
     '<' => 'p-=1;',
     '+' => 'm[p]+=1;',
     '-' => 'm[p]-=1;',
     '.' => 'putc m[p];',
     ',' => 'm[p]=STDIN.getbyte if !STDIN.eof;',
     '[' => '(',
     ']' => ')while((m[p]&=255)!=0);')
#!/usr/bin/env perl
%c=qw( > $p++;
       < $p--;
       + $b[$p]++;
       - $b[$p]--;
       . print+chr$b[$p];
       , $b[$p]=ord(getc);
       [ $b[$p]&=255;while($b[$p]){
       ] $b[$p]&=255;} );
$/=$,;$_=<>;s/./$c{$&}/g;eval

External links

  • r-fxxk, a Ruby package that can generate interpreters for arbitrary TrivialBrainfuckSubstitution members.
  • Try BrainSoup , a metalanguage to interpret and run trivial brainfuck substitutions.
    • This REPL is currently not working (likely due to a change in Replit's system), but forking it will automatically upgrade the new fork and allow using it.