🌊 The Fyshhiker's Guide to the Ocean πŸ‹

πŸ‘©β€πŸ’» How to Compile and Run Fysh

βš™οΈ Option 1: Using VSCode

  1. Download the Fysh VSCode extension.
  2. Create a .fysh file.
  3. Write your code.
  4. Press the run button.

βš™οΈ Option 2: Using Command Line

  1. Install the latest version go install github.com/Fysh-Fyve/fysh@latest
  2. Execute with fysh <filename>.fysh.

πŸ™ Fyshing Manual

🐠 Chapter 1: Fysh Syntax

🐟 Variables

  • Meet Steven, our fishy friend. In Fysh, variables like Steven are declared with ><name>. Every line of fysh ends with a wave ~.
><Steven> ~
  • Steven has binary scales. In Fysh, } represents 1 and ) represents 0. Here, Steven is valued at 0b101, which is 5 in decimal.
><steven> = ><})}> ~
  • Steven doesn’t give a flying fysh about scale direction. β‰ˆ for variable assignment is cool with them too.
><steven> β‰ˆ ><}({> ~

πŸ‘οΈ Optional Visuals

  • Steven is blind. You have the power to bless them with sight, but it's completely optional! You can make them biblically accurate by giving them multiple eyes.
><steven> β‰ˆ ><{({Β°> ~
><steven> β‰ˆ ><{({o> ~
><steven> β‰ˆ ><{({°°> ~
><steven> β‰ˆ ><{({oΒ°> ~
><steven> = ><{({Β°oΒ°> ~

βž• Arithmetic with Variables

  • Summing values: A school of Fysh's value is the sum of each member. This gives Steven a value of 0b101 = 0b100 + 0b001 = (5 = 4 + 1).
><steven> β‰ˆ ><{((Β°> ><(({Β°> ~
  • Subtracting values: Sometimes fysh are negative and start to swim backwards. This takes away from the school's value. Steven's value is 0b101 = 0b111 - 0b010 (5 = 7 - 2).
><steven> β‰ˆ ><{{{Β°> <Β°)})>< ~  # 0b101 = 0b111 - 0b010
  • Multiplying values: Fysh often get lonely. This loneliness causes fysh to meet new fysh and proliferate. This gives Steven a value of 0b101010 = 0b110 * 0b111. (42 = 6 * 7)
><steven> = ><{{(Β°> <3 ><{{{Β°> ~
><steven> β‰ˆ ><{{(Β°> β™‘ ><{{{Β°> ~
  • Dividing values: Not every fysh story is a happy one. At times, separation is inevitable, and their division breaks their heart. This gives Steven a value of 0b101 = 0b11001 / 0b101. (5 = 25 / 5)
><steven> β‰ˆ ><{{(({Β°> </3 ><{({Β°> ~
><steven> β‰ˆ ><{{(({Β°> πŸ’” ><{({Β°> ~
  • Using parentheses for complex operations: Fysh are often abducted and isolated into fyshbowls ( ) for terrestrials' amusment. This makes the fysh sad and gives Steven a value of 0b101 = 0b101 / (0b101 - 0b100). (5 = 5 / (5 - 4))
><steven> β‰ˆ ><{({Β°> πŸ’” ( ><{({Β°> <Β°}))>< ) ~

πŸ”ΌπŸ”½ Increment and Decrement

  • 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.
>><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.
<steven><< ~

🍒 Random Number Generation

Random Number: This is a grilled fysh. It generates a random signed 32-bit number that determines the doneness of the fysh.

><####> ~

πŸ“Š Chapter 2: Data Types

πŸ“ Integers

  • Integer: Steven is an integer represented using binary scales. They have scales that are either 1 or 0. Steven's value is 0b101, which is 5 in decimal.
><steven> β‰ˆ ><{({Β°> ~

πŸ“ Floating Point Numbers

  • Floats: Steven can also be a float fysh. To seperate the integer and decimal parts, we use a fysh bone -. Steven's value is 5.5.
><steven> β‰ˆ ><{({-{({Β°> ~
  • Floats with multiple bones: Steven can also have multiple bones to seperate each decimal place. Steven's value is 5 + 0.2 + 0.05 = 5.25.
><steven> β‰ˆ ><{({-{(-{({Β°> ~
  • Floats with numbers larger than 9: If a value in the decimal place is greater than 9, it will occupy an extra decimal place. Steven's value is 15 + 0.15 + 0.005 15.155.
><steven> β‰ˆ ><{{{{-{{{{-{({Β°> ~

πŸ“ Strings

  • Strings: Steven can also be a string fysh. They speak using bubbles. Steven's value is "Hello, World!".
><steven> β‰ˆ 🫧Hello, World!🫧 ~

πŸ“¦ Arrays and Traversal

  • Arrays: A fysh tank [ ] is used create an array. Each item is separated by fysh food -.value is [0b010, 0b010] = [2, 2].
><steven> β‰ˆ [><({(Β°> - ><({(Β°>] ~
  • Accessing Array Elements: These fysh tanks can be traversed using a fysh tank [ ] with a number inside it. Steven returns the element at index 1. Array indexes start at 0.
><steven>[><(({Β°>] ~

🧠 Chapter 3: Fysh Logic and Operations

πŸ€” Logical Operations

  • AND (&&), OR (||), and NOT (!!): Steven is experiencing an existential crisis. They're questioning the very fabric of reality.
    • If steven is real and they found the truth, they're happy. (Steven && theTruth)
    • Steven is happy if either they're real or found the truth. (Steven || theTruth)
    • But then Steven thought about it and said "hey it would be kinda cool if I wasn't real" and is now only happy if they're not real. (!!Steven)
><steven> && ><TheTruth> ~
><steven> || ><TheTruth> ~
!! ><steven> ~

πŸ”§ Bitwise Operations

  • Steven is bored and looking to have their bits rearranged. At Fysh, we're hereto help! We have provided Steven with a variety of tools and bitwise manipulations to satisfy their bit busting needs:
    • AND (&)
    • OR (|)
    • XOR (^)
    • NOT (!)
><steven> & ><(({Β°> ~
><steven> | ><(({Β°> ~
><steven> ^ ><(({Β°> ~
! ><steven> ~
  • Logical shifts: Steven can also use logical shifts! Steven shifts their bits to the left then right by 1.
    • Left shift (<<):
    • Right shift (>>):
><steven> << ><(({Β°> ~
><steven> >> ><(({Β°> ~

🐸 Tadpoles

Tadpoles are Fysh too. They swim towards bigger Fysh (they like the danger) and are represented by ~o or o~. Here, we are checking if Steven is bigger than 5 and less than 7, respectively.

><//> Greater/Less than
><steven> o~ ><{({Β°>
><steven> ~o ><{{{Β°>

><//> Greater/Less than or equal to (replace ~ with β‰ˆ or =)
><steven> o= ><{({Β°>
><steven> β‰ˆo ><{{{Β°>

πŸ”„ Chapter 3: Control Structures

πŸ” While Loops

  • In the whirlpool of Fysh logic, the while loop, represented by @ or πŸŒ€, with the condition stored in either [ ] or ( ). Small fysh define the iterative heart ><> and <><.

Here we repeat the loop while Steve is greater than 5. Steven decrements by 1 each iteration.

πŸŒ€ [><steven> o~ ><{((Β°>]
><>
    <steven><< ~
<><

@ (><steven> o~ ><{((Β°>)
><>
    <steven><< ~
<><

❓ Conditional Statements

Conditional statements run based on how each Fysh feels

  • if statement: are happy since they're the condition you're looking for. They feel wanted and loved. They are represented by a happy Fysh
><(((^> [><steven> o~ ><{((Β°>]
><>
    <steven><< ~
<><
  • else statement: feel like they're the last resort, an afterthought. This makes them feel unimportant and sad. They are represented by a dead Fysh
><(((*>
><>
    ><steven> β‰ˆ ><(((Β°> ~
<><
  • else if statement: are the middle child. They're not the first choice, but they're not the last either. They're represented by both a dead and happy Fysh
><(((*> ><(((^> [><steven> ~o ><{((Β°>]
><>
    >><steven> ~
<><

πŸ§‘β€πŸ”§ Chapter 4: Functions

✏️ Defining Functions

To define a function or SUBroutine, use a submarine >(funcNameHere) along with any parameters ><param>. To return a value, use a squid <~ or πŸ¦‘.

Here the function is called submarine and has 3 parameters. It returns the sum of the 3 parameters.

>(submarine) ><param1> ><param2> ><param3>
><>
    <~ ><param1> ><param2> ><param3> ~
<><

πŸ“ž Calling Functions

  • To call a subroutine, put the submarine in a Fysh tank along with its arguments. If two or more params are next to each other, separate them with Fysh food -.
[>(submarine) ><fysh1> - ><fysh2> - ><fysh3>] ~

βš“ Chapter 5: Output

⛓️ Output Value

When we finally reach our destination, we anchor ourselves. Anchors are used to output the value of a Fysh. They are represented by (+o or βš“

Here we're outputting 0b101 (5).

(+o ><{({Β°> ~

πŸ’¬ Chapter 6: Comments

πŸ”‰ Single-line Comments

Navigator Fysh are used to guide the reader through the code. They are represented by ><//>.

><//> What's cookin' good lookin'?

πŸ”Š Multi-line Comments

For longer explanations, multiline comments are used. They are represented by ></*> and <*\><

></*>
How to grill a Fysh:
1. Catch a Fysh
2. Grill the Fysh
3. Eat the Fysh
<*/><

πŸ“ˆ Examples

❗Factorial Example

This program calculates the factorial of number. In this case 5. The factorial of 5 is 120.

><//> Factorial Example

><number>    β‰ˆ ><{({Β°> ~
><factorial> β‰ˆ ><(({Β°> ~

πŸŒ€ [><number> o~ ><(({Β°>]
><>
    ><factorial> β‰ˆ ><factorial> β™‘ ><number> ~
    <number><< ~
<><
(+o ><factorial> ~

Let's break it down:

  1. ><number> β‰ˆ ><{({Β°> ~ - Declare the number to calculate the factorial of. (5 in this case)
  2. ><factorial> β‰ˆ ><(({Β°> ~ - Declare the factorial variable. (1 in this case)
  3. πŸŒ€ [><number> o~ ><(({Β°>] - While the number is greater than 1, do the following:
    1. ><factorial> β‰ˆ ><factorial> β™‘ ><number> ~ - Multiply the factorial by the number.
    2. <number><< ~ - Decrement the number.
    3. Repeat until the number is 1.
  4. (+o ><factorial> ~ - Output the factorial.

Built With

Share this project:

Updates