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
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
| Command | Does |
|---|---|
i x d x | Add or take away 1 |
s x | Square |
o x | Print the value |
e x 5 e x *y | Set x to a number, or to register y |
loop 5 loop *n | Run 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.
A loop that lowers its own count. After two rounds the count is 1, so it stops.
Patterns it teaches
- Turing tarpit: a handful of commands and one loop.
- Counter machines: the specification proves it complete through Minsky machines.
Further
See also
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 largefishSource
- 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