esolang

LargeFish

Deadfish with as many registers as you like, and a loop that keeps checking how long it should run.

ChuckEsoteric08, 2023 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: 1 2 3 4 5

The idea

ChuckEsoteric08 made LargeFish in 2023, after BigFish, which came from Deadfish. It keeps the four Deadfish commands and gives each a register by name, then adds a way to set a register and a counted loop.

Read the story

The loop has no condition, only a count, but the count may be a register, and it is read again every time the body ends. A loop whose count is 0 never starts, and one whose body sets its count to 1 stops after one round. That is how LargeFish tests for zero, and with that test it runs Minsky machines, so it is Turing complete.

The machine

CommandDoes
i x d xAdd or take away 1
s xSquare
o xPrint the value
e x 5 e x *ySet x to a number, or to register y
loop 5 loop *nRun the body that many times, up to endloop

Registers start at 0. At each endloop the count is read again, and the loop ends once the body has run that many times.

Example

The counter prints 1 to 5.

The counter prints 1 to 5.

The zero test. When x is not 0 the body runs once and sets test to 1, which ends the loop.

Expected: 1

A loop that lowers its own count. After two rounds the count is 1, so it stops.

Expected: 3 2

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from LargeFish

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run largefish -e 'e test *x
loop *test
e test 1
endloop'
shib manual largefish

Source

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

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

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