Fysh
- Not to be confused with ><>.
Fysh is an esoteric programming language that embraces creativity and a playful aquatic theme. It uses fish-related symbols and terms to represent programming concepts, making coding a fun and engaging experience. It was invented by User:Pointless & User:PinesLover69 in 2024.
For a cleaner documentation check out the GitHub README
π©βπ» How to Compile and Run Fysh
βοΈ Option 1: Using The Online Interpreter
1. Visit The Official Webpage
- Visit Fysh's official webpage at: https://fysh-fyve.github.io/
2. Press Play
- Write your code and press the swim button
βοΈ Option 2: Using VSCode
1. Download the Fysh VSCode Extension
- Install the Fysh extension from the VSCode marketplace.
2. Create a .fysh
File
- Open VSCode and create a new file with the extension
.fysh
.
3. Write Your Code
- Start coding in Fysh!
4. Run Your Code
- Press the run button provided by the extension to execute your program.
βοΈ Option 3: Using Command Line
1. Install the Latest Version of Fysh
- Use the Go command to install Fysh:
go install github.com/Fysh-Fyve/fysh/pkg/go-fysh/cmd@latest
2. Execute Your Fysh Program
- Run your program using the generated Fysh interpreter:
fysh <filename>.fysh
π Fyshing Manual
π¬ Chapter 1: Comments
π Single-line Comments
Single-line comments start with navigator fish ><//>
.
><//> What's cookin' good lookin'?
π Multi-line Comments
For longer explanations, multiline comments are used. They are enclosed with
></*>
and <*\><
></*> How to grill a Fysh: 1. Catch a Fysh 2. Grill the Fysh 3. Eat the Fysh <*/><
π Chapter 2: Fysh Syntax
π Variables
In Fysh, variables are declared using the syntax ><variableName>
. Every line of Fysh code ends with a tilde ~
.
Example:
><Steven> ~
ππ» Assigning Values
Variables can be assigned values using either the β
or =
operator.
Example:
Steven
is assigned the value of CoolFysh
:
><Steven> β ><CoolFysh> ~
π Binary Scales
A fysh's scales represents it's binary value ><})}>
:
- Scales Representing Binary 1:
{
and}
- Scales Representing Binary 0:
(
and)
- Note: The direction of the scales does not matter.
{
and}
both represent binary1
, and(
and)
both represent binary0
.
Example:
Here we assign the binary value 0b101
(5 in decimal) to Steven
:
><steven> β ><})}> ~
ποΈ Optional Visuals
><})}>
is blind, but we can give it eyes... multiple eyes! ππ
Valid Eye Symbols: o
, Β°
- Note: This is completely optional and purely for aesthetics.
><steven> β ><})}Β°> ~ ><steven> β ><{({Β°> ~ ><steven> β ><{({o> ~ ><steven> β ><{({°°> ~ ><steven> β ><{({oΒ°> ~ ><steven> β ><}({Β°oΒ°> ~
β Chapter 3: Arithmetics
β Addition
To add two fyshes, place variables or values next to each other. The value of a school of Fysh is the sum of each member.
Example:
steven = 4 + 1 (binary: 0b100
+ 0b001
)
><steven> β ><{((Β°> ><(({Β°> ~
In this example:
><{((Β°>
represents0b100
(4)><(({Β°>
represents0b001
(1)steven
is assigned4 + 1 = 5
β Subtraction
Some fysh are negative and start to swim away. Fysh swimming to the left take away from the school's value.
- Note: Fysh swim to the left flips the sign of the fysh. So a negative variable swimming left will become positive.
Example:
steven = 7 - 2 (binary: 0b111
* 0b010
)
><steven> β ><{{{Β°> <Β°)})>< ~
β€οΈ Multiplication
Fysh often get lonely. This loneliness causes fysh to meet new fysh and proliferate, quickly multiplying their numbers.
- Note: Every possible representation of a heart is valid for multiplication. If there's a heart that doesn't work, please let us know.
Example:
steven = 6 * 7 (binary: 0b110
* 0b111
)
><steven> = ><{{(Β°> <3 ><{{{Β°> ~ ><steven> β ><{{(Β°> β‘ ><{{{Β°> ~ ><steven> β ><{{(Β°> π ><{{{Β°> ~
π Division
Not every fysh story is a happy one. At times, separation is inevitable, and their division breaks their hearts, causing their numbers to dwindle.
Division is represented by a broken heart </3
or π
.
Example:
Steven = 25 / 5 (binary: 0b11001
/ 0b101
)
><steven> β ><{{(({Β°> </3 ><{({Β°> ~ ><steven> β ><{{(({Β°> π ><{({Β°> ~
π£ Fysh Bowls (Parentheses)
Fysh are often abducted and kept in small glass fysh bowls for the amusement of land-dwellers. These bowls are represented by ( )
.
This is used to group fysh together, allowing their operations to be performed first.
Example:
steven = 5 / (5 * 4) (binary: 0b101
/ (0b101
* 0b100
))
><steven> β ><{({Β°> π ( ><{({Β°> <Β°}))>< ) ~
π Increment
As life goes on, we learn from our mistakes and improve. Stevenβs self help journey allowed them to grow an extra tail, incrementing their value by 1.
Example: steven = steven + 1
>><steven> ~
π Decrement
Sometimes we feel like a fyshup, a failure. And that's ok, itβs a part of being fysh. However for some fysh, this feeling is too much to handle and is internalized. They havenβt received the emotional support they need and have gone on a downward spiral, causing them to feel worthless. They begin to retreat and try to swim away in the opposite direction causing their value to decrement by 1.
Example: steven = steven - 1
<steven><< ~
π’ Random Number Generation
The random number generator is represented with a grilled fysh. It generates a random signed 32-bit number that determines the doneness of the fysh.
Example:
><###> ~
π Chapter 4: Data Types
π Integers
Fysh with binary scales ><})}>
are integers.
Example:
Steven = 5 (binary: 0b101
)
><steven> β ><{({Β°> ~
𦴠Floats with One Bone
Some people like to play with their food, so they pick away at steven, leaving only a fraction of them behind. This exposes the bones (-
) of the fysh. Bones help to separate the integer and decimal parts of the fysh.
Example:
><steven> β ><{{{-{({Β°> ~
Explanation:
><{{{-
represents the integer part7
(binary:0b111
)-{({Β°>
represents the fractional part0.5
(binary:0b101
)- Steven's value is
7 + 0.5 = 7.5
.
π¦΄π¦΄π¦΄ Floats with Multiple Bones
When multiple bones are present, the additonal values are added at the end of the decimal part. Steven's value is 2 + 0.15 + 0.005 = 15.155
.
Example:
><steven> β ><{(-{{{{-{{{Β°> ~
Explanation:
><{(-
represents the integer part2
(binary:0b10
)-{{{{-
represents the fractional part0.15
(binary:0b1111
)-{{{Β°>
represents the additional fractional part0.007
(binary:0b111
)- steven's value is
2 + 0.15 + 0.007 = 2.157
.
𫧠Bubbles (Strings)
Fysh blow bubbles, and these bubbles can be used to represent strings.
Bubble strings are enclosed in π«§
or *
.
Example:
><steven> β π«§Hello, World!𫧠~ ><steven> = *Hello, World!* ~
π¦ Arrays and Traversal
Arrays are represented by a fysh tank [ ]
. Each item is separated
by fysh food *
.
Example:
steven = [6,2] (binary: [0b110, 0b010]
)
><steven> β [><{{(Β°> * ><({(Β°>] ~
To access array elements, use the array variable followed by [index]
.
- Note: Array indexes start at 0.
Example: steven[1] (accessing the second element of steven)
><steven>[><(({Β°>] ~
β Chapter 5: Output
βοΈ Output Value
To output the value of a variable, use an anchor (+o
or β
.
Example:
Output the value of Steven
:
(+o ><{({Β°> ~
π§ Chapter 6: Fysh Logic and Operations
πΈ Tadpoles
The greater than and less than operations are represented by tadpoles ~o
and o~
. Tadpoles swim towards the bigger Fysh, indicating the direction of the comparison.
Example:
><//> Greater/Less than ><steven> o~ ><{({Β°> ~ ><//> Steven > 1 ><steven> ~o ><{{{Β°> ~ ><//> Steven < 7 ><//> Greater/Less than or equal to (replace ~ with β or =) ><steven> oβ ><{({Β°> ~ ><//> Steven >= 1 ><steven> =o ><{{{Β°> ~ ><//> Steven <= 7
π€ Logical Operations
Fysh supports standard logical operations:
- AND:
&&
- OR:
||
- NOT:
!!
Example:
><steven> && ><Alive> ~ ><//> Steven and Alive ><steven> || ><Alive> ~ ><//> Steven or Alive !! ><steven> ~ ><//> Not Steven
π§ Bitwise Operations
Steven is bored and looking to have their bits rearranged. At Fysh, we're here to help! Steven has been provided with a variety of tools and bitwise manipulations to satisfy their bit busting needs:
AND (&)
OR (|)
XOR (^)
NOT (!)
- Note: Currently does not support floats
><steven> & ><(({Β°> ~ ><//> Steven and 1 ><steven> | ><(({Β°> ~ ><//> Steven or 1 ><steven> ^ ><(({Β°> ~ ><//> Steven xor 1 ! ><steven> ~ ><//> Not Steven
π Logical Shift Operations
You can even use logical shifts! Steven shifts their bits to the left then right by 1.
- Left shift (
<<
): - Right shift (
>>
):
- Note: Currently does not support floats
Example:
><steven> << ><(({Β°> ~ ><//> Steven left shift 1 ><steven> >> ><(({Β°> ~ ><//> Steven right shift 1
π Chapter 7: Control Structures
π While Loops
While loops can be represented using whirlpools:
@
π
><(((@>
The condition stored in either:
( )
fysh bowl[ ]
fysh tank
The loop body is enclosed between ><>
and <><
.
Example:
π [><steven> o~ ><{((Β°>] ><//> while steven > 4 ><> <steven><< ~ ><//> steven-- <>< @ (><steven> ~o ><{((Β°>) ><//> while steven < 4 ><> >><steven> ~ ><//> steven++ <>< ><(((@> [><steven> oβ ><{((Β°>] ><//> while steven >= 4 ><> <steven><< ~ ><//> steven-- <><
β Conditional Statements
Conditional statements run based on how each Fysh feels
π if
Statements: The Happy Fysh ><(((^>
These Fysh are overjoyed because they're the center of attentionβthey feel wanted and loved.
Example:
><(((^> [><steven> o~ ><{((Β°>] ><//> if steven > 4 ><> <steven><< ~ ><//> steven-- <><
π΅ else
Statement: The Sad (Dead) Fysh ><(((*>
These fysh feel like they're an afterthought and are often left behind. This makes them feel sad and dead inside.
Example:
><(((*> ><//> else ><> ><steven> β ><(((Β°> ~ ><//> steven = 0 <><
π else if
Statement: The Middle Child ><(((*> ><(((^>
These fysh are a combination of a dead and a happy fish, symbolizing the middle child. Not the first choice but not the last.
><(((*> ><(((^> [><steven> ~o ><{((Β°>] ><//> else if steven < 4 ><> >><steven> ~ ><//> steven++ <><
π§βπ§ Chapter 8: Functions
βοΈ Defining Functions
Functions (subroutines) are defined using a submarine >(functionName)
, with parameters ><param>
. The function body is enclosed between ><>
and <><
. To return a value, use a squid <~
or π¦
.
Example:
>(add) ><param1> ><param2> ><//> def add(param1, param2) ><> <~ ><param1> β‘ ><param2> ~ ><//> Return the product of param1 and param2 <><
π Calling Functions
To call a function, place the submarine in a fish tank [ ]
, along with its arguments, separated by fish food -
.
- Note: The submarine can be placed anywhere in the fish tank as long as the arguments are in the correct order.
Example:
[>(submarine) ><fysh1> * ><fysh2>] ~ ><//> submarine(fysh1, fysh2)
π Examples
βFactorial Example
This program calculates the factorial of a number, in this case, 5. The factorial of 5 is 120.
><//> Factorial Example ><number> β ><{({Β°> ~ ><//> number = 5 ><factorial> β ><(({Β°> ~ ><//> factorial = 1 π [><number> o~ ><(({Β°>] ><> ><factorial> β ><factorial> β‘ ><number> ~ ><//> factorial = factorial * number <number><< ~ ><//> number-- <>< β ><factorial> ~ ><//> print(factorial)
Explanation:
1. Variable Declarations:
><number> β ><{({Β°> ~
assigns 5 tonumber
.><factorial> β ><(({Β°> ~
assigns 1 tofactorial
.
2. While Loop:
π [><number> o~ ><(({Β°>]
loops whilenumber
> 1.- Inside the loop:
- Multiply
factorial
bynumber
. - Decrement
number
.
- Multiply
3. Output:
β ><factorial> ~
outputs the calculated factorial.
πFibonacci Example
This program calculates the nth Fibonacci number, in this case, the 7th. The 7th Fibonacci number is equal to 13.
><//> Fibonacci Example >(fib) ><n> ><//> def fib(n) ><> ><(((^> [><n> ~o ><({(Β°>] ><//> if n < 2 ><> π¦ ><n> ~ ><//> Return 'n' if 'n' < 2 <>< ><(((*> ><//> else ><> ><a> β [>(fib) ><n> <({><] ~ ><//> a = fib(n * 1) ><b> β [>(fib) ><n> <{(><] ~ ><//> b = fib(n * 2) π¦ ><a> ><b> ~ ><//> Return a + b <>< <>< ><result> β [>(fib) ><{{{Β°>] ~ ><//> result = fib(7) β ><result> ~ ><//> print(result)
Explanation:
1. Function Definition:
>(fib) ><n>
defines the functionfib
with parametern
.- If
n
is less than 2:- Return
n
.
- Return
- Else:
- Compute
a = fib(n * 1)
. - Compute
b = fib(n * 2)
. - Return
a + b
.
- Compute
2. Function Call:
><result> β [>(fib) ><{{{Β°>] ~
callsfib(7)
and assigns the result toresult
. result = fib(7)
3. Output:
β ><result> ~
outputs the 7th Fibonacci number (13).
External Resources
Happy Fyshing! π