esolang

BigFish

Deadfish with as many registers as you make, and a loop that counts.

Yes, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

The idea

The user Yes made BigFish in 2022, after Deadfish. Deadfish has one accumulator. BigFish starts with no registers at all, and new makes the next one, numbered from 1. Every Deadfish command then names the register it works on.

Read the story

It adds one control structure, loop n { }, which runs its body n times. The count is a number written in the program, so every BigFish program stops. The specification counts it as a joke language with output only.

The machine

CommandDoes
newMake the next register, holding 0
i 1 d 1Add or take away 1 from register 1
s 1Square register 1
o 1Print register 1
loop 10 { }Run the body 10 times

o prints the number and a line feed, and there is no Deadfish reset at 256.

Example

One program prints 1 to 100 with one loop, and another with a loop of 10 inside a loop of 10.

One program prints 1 to 100 with one loop, and another with a loop of 10 inside a loop of 10.

Squaring grows fast. Register 1 goes 2, 4, 16, 256, 65536.

Expected: 2 4 16 256 65536

Patterns it teaches

  • Turing completeness: unbounded registers, but no loop that depends on the data, so it is not complete.

Further

Also in Jokes

Write your own in Run Convert a program from BigFish

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bigfish -e 'new
loop 100
{
i 1
o 1
}'
shib manual bigfish

Source

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

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

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