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:

Binary code Stack operation
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

O_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOOO_ooooooooo
OOOOOOO_ooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_ooooooooo
OOOOO_o
OOOOOOOOOOOOOOO_ooooo
OOOOOOOOO_o
O_ooooooooo
O_ooooooooooooo
OOOOOOOOOOOOO_ooooooooo
OOOOOOOOOOOOOOO_ooooooooo
OOOOO_o
OOOOO_ooooooooo
O_ooooooooo
OOOOO_ooooooooo
OOOOOOOOOOOOO_o
OOOOOOOOOOOOO_ooooooooooooo
O_ooooooooo
OOOOO_ooooooooo
OOO_ooooo
OOOOO_ooooooooo
OOOOO_o
OOOOOOOOOOOOOOO_ooooo
OOOO_ooooooooooooo
O_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOOO_o
OOOOOOO_o
OOOOO_ooooooooo
OOOOOO_o
OOOOOOOOO_ooooooooo
OOOOO_ooooooooo
OOOOOOOOO_o
OOOOOOOO_o
OOO_ooooo
OOOOOO_ooooooooo
OO_ooooooooo
OOOOO_o
OOOOOO_ooooooooooooo
O_o
OOOOOOOOOOOOOOO_ooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOOO_o
OO_o
OOOOO_ooooooooo
OOOOOO_o
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOO_ooooooooooooo
OOOOOOOO_o
O_ooooooooo
OOOOOOOOO_o
OOOOOO_o

Interpreter

  • Common Lisp implementation of the O_o programming language. The program embraces, besides the interpreter, an encoder, as as well a brainfuck-to-O_o converter.