Queue based

From Esolang
Jump to navigation Jump to search

Queue based is an esolang by User:ChuckEsoteric08. The name does not only implies that it stores data in queues but also means that using Queue is based. It's main inspirations were Underload and Smurf

Specification

Queue based stores data in two queues. When you go to nonexisting label or try to dequeue if queue is empty program will halt

(abc) - enqueue string abc
, - dequeue
@ declare new label
; - switch to diffirent queue
' - dequeue and goto label at index n, where n is length of dequeued element.
/ - enqueue a byte from user input
\ - dequeue and output
[abc_xyz] - this command is core of the language. It replaces every element which is equal to abc with xyz
~ - reverse queue
^ - dequeue and enqueue

Computational class

Queue based is Turing-complete because there is (untested) Bitwise Cyclic Tag interpreter in it:

~@~/[0_..][1_...][$_....]~'@~(..)(.)~'@~(...)(.)~'@~;
~@~/[0_......][1_.......][$_........]~'@~(..)(.)~'@~(...)(.)~'@
[......_............][......_.............];[.._..........][..._...........]~
@[.............._..........][..............._...........]~'
@(..........);,;(.........)~'
@(...........);'
@~(............)~;(.........)~'
@~(.............)~;[.........._..............][..........._...............]'
@~(..............)~(.........);(............);~'
@~(...............)~(.........);(.............);~'

This interpreter dosen't use any ^ so this will also prove Turing-completness even with this restriction. Input should be like that: Program$Data$

See also