SQD

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

SQD (Stack, Queue and Deque) is an esolang by User:ChuckEsoteric08.

Specification

SQD uses Stack, Queue and Dequeue as memory.

Commands for Stack:

number from 0 to 9 followed by 0 - push number from 0 to 9 to the stack.
+, -, * or / followed by 0 - pop a and b and push b<op>a.
?0 - pop and declare label with popped element as its name.
=0[...] - pop a and b and if they are equal execute code inside the brackets.
>0[...] - pop a and b and if they b>a equal execute code inside the brackets.
<0[...] - pop a and b and if they b>a equal execute code inside the brackets.
"0 - pop element and goto label which names is equal to popped value.
:0 - duplicate top element.
;0 - pop a and b then push b a times.

Commands for Queue:

number from 0 to 9 followed by 1 - enqueue number from 0 to 9.
+, -, * or / followed by 1 - dequeue a and b and enqueue a<op>b.
?1 - dequeue and declare label with dequeued element as its name.
=1[...] - dequeue a and b and if they are equal execute code inside the brackets.
>1[...] - dequeue a and b and if they a>b equal execute code inside the brackets.
<1[...] - dequeue a and b and if they a>b equal execute code inside the brackets.
"1 - dequeue element and goto label which names is equal to dequeued value.
:1 - duplicate bottom element.
;1 - dequeue a and b then enqueue a b times.

Commands for Dequeue:

number from 0 to 9 followed by 20 - push digit x to the top
+, -, * or / followed by 20 - pop a and b from top and push b<op>a to top
?20 - pop and declare label with popped element as its name
=20[...] - pop a and b from top and if they are equal execute code inside the brackets
>20[...] - pop a and b from top and if they b>a equal execute code inside the brackets
<20[...] - pop a and b from top and if they b>a equal execute code inside the brackets
"20 - pop element and goto label which names is equal to popped value
:20 - duplicate top element
;20 - pop a and b then push b a times
number from 0 to 9 followed by 21 - enqueue x
+, -, * or / followed by 21 - pop a and b from bottom and push a<op>b to the bottom
?21 - dequeue and declare label with dequeued element as its name
=21[...] - pop a and b from bottom and if they are equal execute code inside the brackets
>21[...] - pop a and b from bottom and if they a>b equal execute code inside the brackets
<21[...] - pop a and b from bottom and if they a>b equal execute code inside the brackets
"21 - dequeue element and goto label which names is equal to dequeued value
:21 - duplicate bottom element
;21 - dequeue a and b then enqueue a b times
& - pop element from bottom and push it to top
$ - pop element from top and push it to bottom