O_o

From Esolang
Jump to navigation Jump to search

O_o is a brainfuck derivative by User:BoundedBeans that formats its code like elongated eyebrow raise emojis. It is mostly equivalent to brainfuck, except that it has a stack for each tape cell.

Encoding

  • Start with brainfuck instructions.
  • Assign them to binary according to this: >000 <001 +010 -011 .100 ,101 [110 ]111
  • Concatenate 2 instructions along with binary value of instruction *I (we'll get to *I later)
  • Take the resulting 8 bits and split into two halves.
  • For the first half, convert into unary with symbol "O" and add one extra symbol.
  • Concatenate the resulting string with "_".
  • For the second half, convert into unary with symbol "o" and add one extra symbol.
  • Concatenate the two halves.
  • Add newline.
  • Repeat for every pair of instructions.

Now you have a line of O_o, representing 2 brainf*** commands and two extra bits. Those extra bits are the value of *I.

Also, on the left half of capital O's, there can be a digit 0 to make no commands, allowing *I to be executed on an odd instruction, and allowing odd numbers of instructions in a program. This will use a different unary format on the right, where it will be a 5-bit number in unary containing the command and *I. This is because the instructions are split between the two sides in weird ways.

*I

So what is *I? Well, it's an extra command. It's represented by two bits.

O_o has a stack for every cell, and *I manipulates it.

Here are the commands of *I 00: Nothing 01: Push the value of the current cell to the current stack 10: Pop into the cell 11: Pop the top element off of the currently pointed stack, and push it to the stack of the cell to the right of the pointer.

The stack is treated as 0 if popped when there is nothing; an error should not be thrown. This can be used to pop until the stack is empty by using the not 0 loop.

Examples

Cat

OOOOOOOOOOOO_ooooooooo
OOOOOOOOOO_ooooo
0_ooooooooooooooooooooooooooooo

=Hello world

OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOOOOOOOOOO_o
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOOOOOOOOOO_o
OOOOO_ooooooooo
O_ooooooooo
OOOOO_ooooooooo
O_ooooooooo
OOOOO_ooooooooo
O_ooooooooo
OOO_ooooo
OOO_ooooo
OOOOOOOO_ooooooooooooo
O_ooooooooo
O_ooooooooo
O_ooooooooooooo
O_o
OOOOOO_ooooooooo
OOOO_ooooooooooooo
OOO_ooooooooooooo
OOOOOOOOOOOOOOO_o
OO_o
O_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOOOOOOO_o
OOOOO_ooooooooo
OOOOOO_o
O_o
OOOOOOOOO_ooooo
OOOOOOOO_o
OOOO_o
OOOOO_ooooooooo
OOOOOO_o
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOO_o
O_o
OOOOOO_o
O_ooooooooo
OOOOOO_o