esolang

CounterScript

Counters that count up, count down and loop. Nothing else.

Azerty, 2026 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: A=0 B=6

The idea

Azerty made CounterScript in March 2026 to study very small programs, to list them all and to hunt Busy Beavers among them. There are as many counters as you like. Each holds a whole number from 0 up, and each starts at 0. There is no input and no output; a program only moves numbers between counters.

The machine

CommandDoes
X++;Add 1 to X
X--;Take 1 from X if X is above 0
while X {...}Repeat the block while X is above 0

The specification also writes while X > 0 {...}, which means the same. Since the language has no output, this implementation shows the result when a program halts. It prints each counter the program names, in the order it first appears, as name=value on its own line.

Example

The first is the 3 times 2.
Expected: A=0 B=2

The first is the 3 times 2. Each turn of the loop takes 1 from A and adds 2 to B. The second moves A into B, as the transfer does. The A++; while A {A++;} never halts, since A only grows.

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from CounterScript

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: counterscript.

Command line

shib run counterscript -e 'while A {A--; B++;}'
shib manual counterscript

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/counterscript.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org