A Queue which can't grow
A Queue which can't grow (AQWCG) is an esolang by User:ChuckEsoteric08.
Specification
A Queue which can't grow uses a queue of integers to store data. Its initial state is set to user input with elements being seperated by ;
There are only two (three counting \ which is a nop) commands:
|
Which dequeues element, increments it, and enqueues result
/
Which dequeues element, If it's nonzero decrements it, and enqueues result. If it's zero it would enqueue zero and jump forward to matching \
Program never halts.
We could also define language so that it would use tape instead of queue:
|
Increments cell and moves right
/
If current cell is nonzero decrement it, and moves right. If it's zero it would move right and jump forward to matching \
Examples
Counter
This counter program simply increments all of the user inputs in a perpetual manner:
|
Adder
The following program expects two numbers, incrementing the second by the first one's value, and repeating the process by a reversal of the roles:
/|\
Computational class
AQWCG is Turing-complete because it's possible to translate Minsky machines to it. For simplicity we would use notation where x is length of a Queue and (commands:x) would execute commands x times.We could define command INC2 which would move left and increment cell:
INC2 = (|:x)(/\:x-1)
DEC2 would decrement instead:
DEC2 = (|:x-1)(/\:x)
SKIP code ENDSKIP would execute code if cell is nonzero. Note that code should end with pointer pointing to the same cell.
SKIP code = / INC2 code | ENDSKIP = \ DEC2
It's enough commands to compile Minsky machine to it. Queue is initialised as 0 followed by initial values of Minsky machine registers. That 0 is used as Instruction pointer for Minsky machine program.
Interpreter
- Common Lisp implementation of the A Queue which can't grow programming language.