Skound
Eight commands, numbers only, and a program that never ends on its own. It stops when it pops an empty stack.
TriMill, 2019 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
TriMill made Skound in 2019, to be easy to interpret and hard to program in. There is an accumulator and a stack, and the only input and output are whole numbers. The program runs in a loop. After the last character it starts again at the first, and the one way out is ^ on an empty stack.
Read the story
There is a single branch. # jumps past the next # when the accumulator is above 0, so a pair of # marks a block to skip. The last # jumps back to just after the first one.
The machine
| Command | Does |
|---|---|
+ - | Add or take 1 |
0 | Set the accumulator to 0 |
V | Push the accumulator |
^ | Pop into the accumulator, or halt if the stack is empty |
# | If the accumulator is above 0, jump past the next # |
I O | Read or print a number |
Every other character is ignored. The specification does not say how numbers are printed. Each one gets its own line.
Example
The cat that stops after one number.
The cat that stops after one number. 0 and the first # do nothing, and then ^ finds the stack empty.
The cat that runs until it reads 0 or less. While the number is above 0, the first # jumps past the second and the loop starts over.
The truth machine. On 0 it prints 0 and halts. On 1 it prints 1 forever, with one more 0 on the stack each time round.
The Hello World counts up to each character code with +, prints it with O and resets with 0. It prints 72, 101, 108 and ten more numbers, with 1,129 plus signs in all.
Patterns it teaches
- Stack machines: one stack and an accumulator in front of it.
- Turing tarpit: easy to interpret, hard to write in.
Further
See also
Stack-based
Write your own in Run Convert a program from Skound
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: skound.
Command line
shib run skound -e 'IO#^#' --input '5
3
0'shib manual skoundSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/skound.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org