Deadfish

From Esolang
Jump to navigation Jump to search

Not to be confused with Deadfih.

Deadfish is a very odd interpreted programming language created by Jonathan Todd Skinner. It was released under public domain and was originally programmed in C, but has since been ported to many other programming languages (see below).

Deadfish has a way to output things but it has no way to input them! It only has a few commands, only four in total. It is also case-sensitive, and can deal only with integer values when adding or subtracting, however once squared this number increases greatly!

You can have several commands per line, at least in the C implementation.

Errors are not acknowledged: the shell simply adds a newline character!

Anything that is not a command is not accepted by the interpreter. As you've probably assumed deadfish was created in less than a hour, and can be very useful in creating highly interactive programs.

Commands

Increment Decrement Square Output Halt (optional)
Standard Deadfish i d s o h
XKCD variation x d k c
f() variation f f() f () f(())
F!-- variation F! U! C! K!
嘭!哐!叮!呲!咣! variation 嘭! 哐! 叮! 呲!
Sakana variation
ΙΧΘΥΣ variation ι χ θ υ
Pește mort variation c s p i o
Numbered DeadFish 1 2 3 4 5

Sometimes, the additional command 'h', meaning halt, is used. Although the comment in the C implementation states /* Make sure x is not greater then [sic] 256 */, the implementation sets the value to zero if and only if value == -1 || value == 256.

Why "deadfish"?

Deadfish started out as a subset of HQ9+, as all it would do would be to print out hello world and give an iou depending on how many times the command 9 was entered for how many 99 bottles of beer programs it owed the programmer. Deadfish was originally going to be called fishheads as programming in this language is like eating raw fish heads. However, due to the limiting features of the language, programming in this language became like eating (and having to smell) dead, rotting fish heads, an experience not often generally considered pleasurable.

Example programs

Note: the standard shell adds >> characters for readability.

>> i
>> 
>> o
1
>> d

This program prints the ASCII values (as numbers, not characters, since Deadfish does not have character output) of the characters in the string "Hello, world!"

iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiooiiio
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddo
dddddddddddddddddddddsddoddddddddoiiioddddddoddddddddo
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddo

XKCD Random Number:

iiso

Mandatory test cases

Since the proper behavior of Deadfish arithmetic can be *cough* surprising, here are a few important test cases for people making interpreters: The program

iissso

should print 0; the program

diissisdo

should print 288; and the program

iissisdddddddddddddddddddddddddddddddddo

should print 0.

Interpreters that do not support these test cases and cannot trivially be fixed may be removed from the implementations subpages. In particular, it is required to support numbers at least up to 17^2 == 289 to showcase the strange behavior also of the s command.

Implementations

Deadfish has been implemented in a very wide range of languages – it is something of a popular problem for demonstrating the capabilities of a new language, or simply as a fun exercise to implement.

Due to its length, the list of implementations has been split out into subpages:

Variants of deadfish

  • ><x±∔> is a crossbreed between 4 esolangs, including deadfish. It is also a superset of ><x>.

See also

External resources