Skip to content

Spoon part

Ivan Zolotarev edited this page Apr 7, 2017 · 2 revisions

Spoon - derived from Brainfuck language. It differs from the ancestor in only 2 moments:

  1. Added 2 new instructions. One prints all the memory completely, the second interrupts the execution of the program, thereby completing it.
  2. All instructions are compressed according to the Huffman algorithm. Thanks to it, the most frequently used increment instruction is encoded with only one character (1), less frequently used decrement - three characters (000), 2 new and less frequently used instructions are coded with eight characters.

Since all the Brainfuck instructions have their equivalent in Spoon, we just write the source on it, and then we'll convert to Spoon. The principle of writing is the same as before:

+++++++++[>+++++++++<-]>++.    print 'S'
<+++++[>++++++<-]>-.           print 'p'
-.                             print 'o'
.                              print 'o'
-.                             print 'n'
>>++++++++[<++++>-]<.          print ' '
[-]<++.                        print 'p'
++.                            print 'r'
---.                           print 'o'
--------.                      print 'g'
+++++++++++.                   print 'r'
>++++[<---->-]<-.              print 'a'
++++++++++++.                  print 'm'

Let's compose the correspondence table of the instructions:

Brainfuck Spoon
> 010
< 011
+ 1
- 000
. 001010
[ 00100
] 0011

And then we transform the source code (for convenience of perception spaces between instructions are added):

010                                                                          head
1 1 1 1 1 1 1 1 1 00100 010 1 1 1 1 1 1 1 1 1 011 000 0011 010 1 1 001010    print 'S'
011 1 1 1 1 1 00100 010 1 1 1 1 1 1 011 000 0011 010 000 001010              print 'p'
000 001010                                                                   print 'o'
001010                                                                       print 'o'
000 001010                                                                   print 'n'
010 010 1 1 1 1 1 1 1 1 00100 011 1 1 1 1 010 000 0011 011 001010            print ' '
00100 000 0011 011 1 1 001010                                                print 'p'
1 1 001010                                                                   print 'r'
000 000 000 001010                                                           print 'o'
000 000 000 000 000 000 000 000 001010                                       print 'g'
1 1 1 1 1 1 1 1 1 1 1 001010                                                 print 'r'
010 1 1 1 1 00100 011 000 000 000 000 010 000 0011 011 000 001010            print 'a'
1 1 1 1 1 1 1 1 1 1 1 1 001010                                               print 'm'
00101111                                                                     stop
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1                  tail
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1                  --//--
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1                  --//--
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1                    --//--

Try this source in here.

Combine all 3 source codes:

DCBA@?\nZ;|38x0SA3tsN`Lo98*G"'&%$#Sc>`v<zLxwI5tWrDpoAm?Oj)Laf8dc\aZ~X|?U=Y;v9ONS54JnHG/jJCBGF(
>b%;_"876Z{321U5.-Qr*N('K%$H(hEf${Abaw=^zs9Zp6Wm3kj0Qglk+voooooooooo1oo>>o+ooooooooo11oooo++oo
ooooooooooooo1ooooo+ooooo+oooooo1ooooo+ooo[oooooo11oooooo<oooooooooo1ooooo+ooooooooo100ooo++oo
ooooooooooooo10oooo+0oooo+ooooooo0oooo+oooooooooo10oooo++ooooooooooo1ooooo+ooooooooo11oooo++oo
>oooooooooooo1ooo-o1oooo]ooooooo1ooooo<oooooooooo11o.oo>+ooooooooooo10oooo+ooooooooo11oooo++oo
oooooooooooooo0oooo+0oooo+[oooooo0oooo<ooooooooooo00ooo++ooooooooooo1ooooo+ooooooooo10oooo++oo
ooooooooooooo10oooo+ooooo+oooooo1ooooo+oooooooooo100ooo>oooooooooooo10oo-ooooooooo]o100ooooooo
oo<oooooooooo1oo.oo>ooooo+oooooo1ooooo+oooooooooo11oooo++oooooooo[oo1oooo<oooooooooo110o--oooo
oooooooooooooo0oo-o10oo-ooooooooo0oo>ooooooooooooo0oo-ooooooooo]oooo10ooo<oooooooooo11oo-ooooo
ooooooooooooo1oo.oo+ooooo+oooooo1ooooo+oooooooooo110ooo++ooooooooooo1ooooo+ooooooooo100ooo++oo
oooooooooooooo0o.oo+0oooo+ooooooo0oooo+oooooooooo110ooo++ooooooooooo10o.-oooooooooooo00o--oooo
oooooooooooooo0oo-oo0oo-ooooooooo0oo-oooooooooooo10oo--ooooooooooooo10o.>o+oooooooooo00ooo++oo
ooooooo[<ooooo0oooo+0oooo+ooooooo0oooo+oooooooooo10oooo++ooooooooooo10o>-ooooooooo]oo00ooooooo
oo<oooooooooo10o.oo>ooooo+oooooo10oooo+ooooooooooo00ooo++oooooooo[ooo0ooo<ooooooooooo00o--oooo
ooooooooooooo10oo-o10oo-ooooooooo0oo>oooooooooooo100o-ooooooooo]oooo10ooo<oooooooooo11oo--oooo
ooooooooooooo1oo.oo+ooooo+oooooo1ooooo+oooooooooo11oooo++ooooooooooo1ooooo+ooooooooo100ooo++oo
ooooooooooooo10o.oo>0oooooooooooo0oo>o+oooooooooo11oooo++ooooooooooo1ooooo+ooooooooo11oooo++oo
ooooooooooooo10oooo+ooooo+[ooooo10oooo<ooooooooooo00ooo++oooooooooooo0oooo+oooooooooo00ooo+ooo
>oooooooooooo1ooo-o10ooo]ooooooo1ooooo<oooooooooo100.oooooooooooo[oo10oo-ooooooooo]o100ooooooo
oo<ooooooooooo0oooo+ooooo+oooooo10oooo+ooooooooooo00ooo++oooooooooooo0o.oo+oooooooooo00ooo+ooo
oooooooooooooo0o.-o1ooo-oooooooo10oo-oooooooooooo11o.--ooooooooooooo1ooo-ooooooooooo100o--oooo
ooooooooooooo10oo-o10oo-oooooooo1ooo-oooooooooooo100.oo++ooooooooooo10oooo+ooooooooo100ooo++oo
oooooooooooooo0oooo+0oooo+ooooooo0oooo+ooooooooooo00ooo++oooooooooooo0oooo+oooooooooo00.oooooo
>ooooooooooooo0oooo+0oooo+oooooo10oooo+oooooooooo100ooo+ooooooooo[ooo0ooo<ooooooooooo00o--oooo
oooooooooooooo0oo-oo0oo-ooooooooo0oo>ooooooooooooo00o-ooooooooo]ooooo0ooo<ooooooooooo00o-ooooo
oooooooooooooo0o.oo+0oooo+ooooooo0oooo+ooooooooooo00ooo++oooooooooooo0oooo+oooooooooo00ooo++oo
oooooooooooooo0oooo+0oooo+ooooooo0oooo+ooooooooooo00ooo+ooooooooooooo0o.oooooooooooo10oooooooo
ooooooooooooo10oooo1oooooooooooo1oooooooooooooooo11ooooooooooooooooo1ooooooooooooooo11oooooooo
ooooooooooooo1ooooo1oooooooooooo1oooooooooooooooo100oooooooooooooooo10oooooooooooooo100ooooooo
ooooooooooooo10oooo1oooooooooooo1oooooooooooooooo110ooooooooooooooooo0oooooooooooooo100ooooooo
oooooooooooooo0oooo1oooooooooooo10oooooooooooooooo00ooooooooooooooooo0ooooooooooooooo00ooooooo
oooooooooooooo0ooooo0oooooooooooo0oooooooooooooooo00ooooooooooooooooo0ooooooooooooooo0oooooooo
ooooooooooooo10ooooo0oooooooooooo0oooooooooooooooo00ooooooooooooooooo0oooooooooooooo110ooooooo
ooooooooooooo1ooooo10oooooooooooo0oooooooooooooooo00ooooooooooooooooo0oooooooooooooo10oooooooo
ooooooooooooo10oooo1oooooooooooo1oooooooooooooooo11ooooooooooooooooo1ooooooooooooooo11oooooooo
ooooooooooooo1ooooo1oooooooooooo1oooooooooooooooo110ooooooooooooooooo0oooooooooooooo10oooooooo
ooooooooooooo10ooooo0oooooooooooo0ooooooooooooooo10ooooooooooooooooo1ooooooooooooooo11oooooooo
ooooooooooooo1oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Now we have 3 languages, go ahead.

Clone this wiki locally