StackBit

From Esolang
Jump to navigation Jump to search

StackBit is a Turing-complete esolang by User:ChuckEsoteric08 that is easy to implement.

Specification

Data is stored in two stacks.

0 - push 0 to the current stack
1 - push 1 to the current stack
~ - switch to another stack
[...] - while top of the stack is 1
* - pop top element

There is also optional command for debuging:

. - outputs top of the stack

StackBit minimalisation

We could minimise number of instruction by combining ~ and 0 into command >

> - switch between stacks and push 0

Then ~ would be:

>*

And 0 is:

>*>

We could also assune that [] is a NOP. Then we could combine ] and 1 into |

| - end loop and push 1

Then ] would be:

|*

And 1 would be:

[|

Turing-completness Proof

The Turing-completeness can be proven by simulating BitBrain-R

Start of the program: 0~000000000~
+ - ~0~
> - ~0~[*~*1~0]*
< - 0~[*~*1~0]*
[...] is same
* - ~1~[~*0~*0]~[*0~*1~]*~