Tueue
Two queues, one accumulator and a goto. Of a queue you only ever see the bottom.
ChuckEsoteric08 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
ChuckEsoteric08 made Tueue, a queue language in the style of assembly. There are two queues and an accumulator. One queue is current at a time and SWP switches to the other. A value is read from the bottom of a queue, the end that DEQ takes, so to keep a value you dequeue it and enqueue it again at the back.
Read the story
The specification makes its case for Turing completeness with an interpreter for Bitwise Cyclic Tag. The program bits sit in the first queue with @ after them and go round and round, while the data string lives in the second. As written it drops a program bit each time the program wraps, so program 0 on data 111 never stops.
The machine
| Instruction | Does |
|---|---|
ENQ x DEQ | Enqueue x to the current queue; dequeue from it |
SWP | Make the other queue current |
INC x DEC x MUL x DIV x | Change the accumulator by x |
MOV x y | Copy x to y |
ADD SUB | Dequeue a and then b, enqueue a+b or b-a |
OUT x ASC x | Print x as a number or as a character |
LAB x JMP x | Mark a line; go there |
IQJ x y IAJ x y | Go to y when the bottom of the current queue, or the accumulator, is x |
IQE x | Go to x when the current queue is empty |
COM ... | A comment |
An argument is a number, a word such as @, ACC for the accumulator, or 1QU and 2QU for the bottom of the first and second queue, no matter which one is current.
Example
The looping counter.
The looping counter. The accumulator holds the line number and the first queue holds the count of asterisks on the line, which ENQ 1 and ADD raise by one.
SUB subtracts the first value it takes from the second.
Further
Ideas it shows
See also
Queue-based
Write your own in Run Convert a program from Tueue
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: tueue.
Command line
shib run tueue -e 'ASC 72
ASC 101
ASC 108
ASC 108
ASC 111
ASC 44
ASC 32
ASC 87
ASC 111
ASC 114
ASC 108
ASC 100
ASC 33'shib manual tueueSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/tueue.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org