Dango

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

please take any inconsistencies with an ocean's worth of salt.

Dango
Paradigm(s) imperative
Designed by User:RaiseAfloppaFan3925
Appeared in 2025
Memory system Stack-based
Computational class Unknown
Reference implementation dango-esolang
File extension(s) .dango, .🍡

Dango is an esolang by User:RaiseAfloppaFan3925 that revolves around dango, a Japanese rice-based dumpling.

Code

Code in Dango are stored in dango (who could have guessed), where each instruction is wrapped in parentheses () (which will be referred to as "dumplings" for the rest of this article, for a lack of a better word) with the line ending with a stick ----.

Operations

"Dumpling" operations

Operation Example Action
() ()---- Null value.
(') (')(Hello, world!)---- Stringify the last pushed value.
('c) ('c)(10)---- Create a Unicode character from the stack top as a code point.
(j) (j)(4)---- Jumps to the line number of the stack top.
(len) (...)(while)(>)(2)(len)---- If the stack top is a dango (the data structure), then the amount of dumplings on it is pushed to the stack. Otherwise, 0 is pushed. The value at the top is preserved, unlike with other instructions.

Function calls

In Dango, a function call is just the function name preceded by a colon (:) inside a dumpling, with the arguments being stored on the stack.

Example:

(:io-write)(')(stdout)(')(Hello, world!)----

Stack (before function call):

top
"stdout"
"Hello, world!"
bottom

Since the dumplings are pushed to the stack and functions take off of the stack, the arguments to the function can be in separate dango as seen above.

Dango operations

These operations operate on the dango memory in the program.

Operation Example Action
eat eat (')(Hello, world!)----, eat Pops the top of the stack and prints it.
fetch fetch 2 Copies the value N slots down from the top of the stack and moves the copy to the top.
remove remove If the top of the stack is a dango, then it removes the value at the end and pushes it to the stack.

Example:

skewer 2 (1)(2)----
eat remove
eat remove

Stack (line 1):

top
(1)(2)----    (Dango)
bottom

Stack (line 2, before eat):

top
1             (Int)
(2)----       (Dango)
bottom

Stack (line 3, before eat):

top
2             (Int)
bottom
skewer <N> skewer 2 (1)(2)---- Pops the top N values off of the stack and stores them in a dango that is pushed onto the stack, with the stack top being stored to the left and the value at top_pos - N being stored to the right.

Example:

eat skewer 3 (1)(2)(3)----

Output:

(1)(2)(3)----

If the amount of values requested to be skewered is greater than 5, then an error occurs. Example:

eat skewer 6 (1)(2)(3)---- skewer 2 (4)(4)---- (5)(6)----

Output:

error: skewer is too short for 6 dumplings

If the amount of values requested to be skewered is zero, then an error occurs. Example:

skewer 0

Output:

error: cannot have dango with zero dumplings, that's just a stick

Values

  • Null/Nil - ()
  • Integers - signed 64-bit integers with overflow and underflow
  • Floats - 64-bit (double-precision) IEEE floats
  • Strings - strings (created by the (') dumpling)
  • Raw text - strings, but with parentheses

Dango

The dango (not to be confused with the language and the code unit in the language) is a stack-like data structure. It is limited to a maximum of 5 values, but it can contain more dango. Dangos are constructed with the skewer keyword which constructs a dango out of the top N values.

REPL Example:

--(O)(O)(O) > eat skewer 3 (1)(2)(3)----
(1)(2)(3)----
()

Here is what happens if a dango contains a dango.

skewer 2 (4)(5)----
(1)(2)(3)----
skewer 4
eat

Output:

(1)(2)(3)[(4)(5)]----

Here is what happens if a dango is constructed with a length greater than 5.

--(O)(O)(O) > eat skewer 6 (1)(2)(3)(4)(5)(6)----
Error: skewer is too short for 6 dumplings
--(O)(O)(O) >

Example Programs

Hello world

eat (')(Hello, world!)----

Truth Machine

(j)(4)(while)(!=)(1)(:io-input)----
eat (1)----
(j)(2)----
eat (0)----

Cat program

eat (:io-input)----