Fish Code

From Esolang
Jump to navigation Jump to search

Fish Code is an esolang invented by User:None1. It is named Fish Code because its programs are shaped like fish.

Syntax

Every line in Fish code must be like this.

<COMMANDS><

When executed, a program starts from the first line, if a jump command isn't executed in one line, the program terminates.

Commands

Fish code uses 2 byte stacks and a byte register.

The byte register is initially 0, the stacks are initially empty.

It doesn't matter which stack is the current stack initially, since that wouldn't affect the behavior of the program.

Overflow and underflow wraps around.

Command Meaning
+ Increment register
- Decrement register
, Read a character and store it in the register
. Print register as ASCII
: Read register as decimal
; Print register as decimal
? Pushes the value of register into the current stack
! Pops from the current stack and store it into register
~ Switch current stack
(A) If the register is zero, jump to line A
[A] If the register isn't zero, jump to line A
{A} Jump to line A no matter what
((x)) Set the register to the value of x (a number)
(((x))) Subtract the value of register by x

Programming in Fish Code is easy because it has more commands, but complicated because you have to manipulate the loops yourself.

Example Programs

Hello World

<((72)).((101)).((108)).((108)).((111)).((32)).((87)).((111)).((114)).((108)).((100)).((33)).><

Cat Program

<,.{0}><

Note: The first line is line 0.

Truth Machine

<,(((48)))(1)[2]><
<(((208))).><
<(((208))){3}><
<.{3}><

Reverse Cat Program

<?{1}><
<,(((10)))[2](3)><
<(((246)))?{1}><
<![4]><
<.[3]><

Nope. Interpreter

<((78)).((111)).+.((101)).((46)).><

Infinite loop

<{0}><

Turing completeness

The language is Turing complete since we can use two stacks to simulate a brainfuck tape, and use the jump commands to simulate brainfuck loops.

External Resources