Duck

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.
Not to be confused with DUCK.
Not to be confused with D.U.C.K..

Duck (Deque stack) is an esoteric language by User:ChuckEsoteric08.

Specification

Duck has two stacks and accumulator. One stack is made out of integers (called "IntStack") and other from 1-byte deques (called "Staque").

Commands:

Command Description !
[abc] Push abc to Staque
0 Push 0 to the IntStack
1 Push 1 to the IntStack
+ Pop two elements from IntStack, a and b and push b+a to IntStack
- Pop two elements from IntStack, a and b and push b-a to IntStack
? Input string and push it to Staque
& Input string and push it to IntStack
!x Declare label x (label name could be only 1-character long)
@x Goto label x
"x"abc" If accumulator is x execute abc
{n|abc|xyz} If accumulator is n execute abc, else execute xyz
(n|abc|xyz) If accumulator is not n execute abc, else execute xyz
.x Push character x to the top of top element of Staque
,x Push character x to the bottom of top element of Staque
: Duplicate top element of IntStack
< Copy bottom of top element of Staque to Accumulator and delete it
> Copy top of top element of Staque to Accumulator and delete it
; Copy top element of IntStack to Accumulator and delete it
^ Push Accumulator to the top of top element of Staque
v Push Accumulator to the bottom of top element of Staque
$abc$x$y$ Repeat abc until top of IntStack will be x and Accumulator will be y
~ Swap top two elements in Staque
' Push Accumulator to IntStack
= Output Accumulator
\n\abc\ if accumulator is n execute abc
*n*abc* if top of IntStack is n execute abc
\n\abc\ if top of IntStack is not n execute abc
%abc%x% repeat abc until top of IntStack is x
`abc`x` repeat abc until Accumulator is x
#comment# Comment

Examples

Truth Machine

&:;{0|=|`=`0`}

Hello World

[Hello, World!]`<=`!`

Cat

There should be . at the end of an input

?`<=`.`

Reverse Cat

There should be . at the begining of an input

?`>=`.`

Brainfuck interpreter

It has 9 cells which can have value from 0 to 9. You can change number of cells by adding or removing zeroes between [ and ]

Version with comments is here

[000000000]?!c<^"+"@+""-"@-"","@,""."@."">"@>""<"@<""["@[""]"@]""!"@!"@c!+~<v'1+~@c!-~<v'1-~@c!,~&;v~@c!.~<v=~@c!>~<^~@c!<~>v~@c![~<v~{0|0$\[\1+\\]\/0/1-/\$0$]$@c|@c}!]~<v~(0|0$\]\1+\\[\/0/1-/\$0$]$@c|@c)!!