# +-)

**+-)** is a minimalistic esolang invented by User:None1 and inspired by brainfuck.

## Memory

There is a tape with three cells, each cell contains an unbounded signed integer. There is also a pointer that wraps around.

## Commands

In +-), there are three commands, both + and - matches ).

`+`

: Increment current cell unless the previous instruction executed is its matching ), then jump to the matching ) if the current cell is zero or the next character is ).`-`

: Decrement current cell unless the previous instruction executed is its matching ), then move the pointer to the right, then jump to the matching ) if the current cell is zero or the next character is ).`)`

: Jump to the matching + (or -) if current cell is nonzero and the previous character is ).

## Computational class

It is Turing complete because it can be translated from 3 cell Brainfuck (without I/O) easily. Proof is below (BF stands for 3 cell Brainfuck in the proof for convenience):

### +

`+`

in BF can simply be translated to `+)`

in BF.

### > and <

We notice that `-)`

in +-) is the same as `->`

in BF, so `>`

is equivalent to `+->`

, which is `+)-)`

in +-).

Because the pointer wraps around, now that we get the translation of `>`

, we can simply translate `<`

by repeating `>`

twice, that is:

+)-)+)-)

### -

`-`

is equivalent to `-><`

. Because `-)`

in +-) is the same as `->`

in BF, `-`

can be translated to `-)+)-)+)-)`

.

### [ and ]

When not before a `)`

, `+`

in +-) is the same as `+[`

in BF, so `[`

, the same as `-+[><`

, can be translated to `-)+)-)+)-)++)-)+)-)+)-)`

.

`]`

can be translated to `)`

.

*Note: >< is a placeholder that does nothing to force the loop to be nonempty. If the >< doesn't exist, empty loops ([]) won't work, because it will be translated to -)+)-)+)-)+), which will do nothing because the last ) is right before a +.*

BF | +-) |
---|---|

+ |
+) |

- |
-)+)-)+)-) |

> |
+)-) |

< |
+)-)+)-) |

[ |
-)+)-)+)-)++)-)+)-)+)-) |

] |
) |