esolang

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

Expected: 42

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

CommandDoes
+ -Add or take 1
0Set the accumulator to 0
VPush the accumulator
^Pop into the accumulator, or halt if the stack is empty
#If the accumulator is above 0, jump past the next #
I ORead 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.

Expected: 5 3 0

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.

Expected: 0

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

Further

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 skound

Source

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