# Stack based

Jump to navigation
Jump to search

*Not to be confused with Stack-based.*

**Stack based** is an esolang by User:ChuckEsoteric08 which is similiar to Queue based but it uses stack instead.

## Specificstion

**Stack based** uses three stacks as memory: a, b and c

push x y

Push x to stack y

pop x

Pop from stack x

move x y

Pop element from stack x and push it to stack y

inp x

Push input to stack x

out x

Pop element from stack x and output that element

lbl x

Declare label x

rep x y z

Similiar to [abc_xyz] in Queue based. Replace every element in stack x which are equal to y with z

jmp x

Pop element from stack x and goto label which name is equal to popped element

rev x

Reverse stack x

## Computational class

The language can be proven to be Turing-complete by this Bitwise Cyclic Tag interpreter:

lbl inpcode inp a rep a 0 inpcode0 rep a 1 inpcode1 rep a $ inpcodeend jmp a lbl inpcode0 push inpcode0 a push inpcode a jmp a lbl inpcode1 push inpcode1 a push inpcode a jmp a lbl inpcodeend rev a lbl inpdata inp b rep b 0 inpdata0 rep b 1 inpdata1 rep b $ inpdataend jmp b lbl inpdata0 push inpdata0 b push inpdata b jmp b lbl inpdata1 push inpdata1 b push inpdata b jmp b lbl inpdataend rev b rep b inpdata0 data0 rep b inpdata1 data1 lbl exec rep a inpcode0 cmd0 rep a inpcode1 cmd1 jmp a lbl cmd0 rev a push cmd0 rev a pop b push exec a jmp a lbl cmd1 rev a push cmd1 rev a jmp b lbl data0 push data0 b push exec a jmp a lbl data1 push data1 b rep a cmd0 next0 rep a cmd1 next1 jmp a lbl next0 push next0 a rev b push data0 b rev b push exec a jmp a lbl next1 push next1 a rev b push data1 b rev b push exec a jmp a

Input Program character by character, then input $ and then input data also character by character and then input $.