哮/English version

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.
This page is written by the language English, and the version of language Simplified Chinese is at .

is created by User:PrySigneToFry and his ChatGPT.

Commands in the language

  1. 哮(xiāo): Create a variable and initialize it with 0.
  2. 咕(gū): Add current variable by 1.
  3. 喵(miāo): Subtract current variable by 1.
  4. 吼(hǒu): Output the value of a variable.
  5. 嘭(pēng): If current variable is 0, jump to the given line.
  6. 唧(jī): Read input and store it into the variable.
  7. 嗡(wēng): Copy current variable to another.
  8. 呼(hū): Swap two variables.
  9. 吱(zhī): Multiply current variable by 2.
  10. 咕咕(gūgū): Divide current variable by 2.

Example code

The following is a simple 哮 program that initializes a variable, does some calculations and outputs the result.

哮 a   // Initialize a with 0
咕      // a = a + 1
咕      // a = a + 1
喵      // a = a - 1
吼 a    // Output a

Syntax

Variables: You can use any character (e.g.: a, b, c) as variable names

Command: Each command is in a line and commands are separated by line feeds.

Comments: # is used for single line comments.

Execution example

Let's say that we have the following program.

哮 x       # Initialize x
咕         # x = x + 1
咕         # x = x + 1
唧         # Input x
吼 x       # Output x
嘭 7       # If x = 0,then jump to line 7

In this example, the program initializes a variable x, adds it by 2, then reads from user input and prints it. If the input is 0, then jump to line 7 (can be other operations).

Extension

Function definition and calling.

Conditionals (e.g.: 哇 and 咗 for if and else, respectively).

Loops (e.g.: 嗖 for while).

This language uses words that represent sounds for commands, it is made for making coding interasting and preserve Turing completeness. I hope this design can stimulate your creativity!

More commands (Made by myself)

  1. 啊(ā): Add a variable by a value.
  2. 乒乓(pīngpāng): Print a string.
  3. 喳(zhā): Read a string and store it into a variable.
  4. 啷(lāng): Delete a variable.
  5. 哕(yuě): True.
  6. 嚎(háo): False

More examples

A+B

哮 a       # Initialize variable a
唧 a       # Read first integer a
哮 b       # Initialize variable b
唧 b       # Read second integer b
哮 c       # Initialize variable c
嗡 a c     # c = a
啊 c b     # c = c + b
吼 c       # Print c

Hello, World!

乒乓 "Hello, world!"     # Print a string

Cat

哮 a       # Initialize variable a
喳 a       # Input a as string
吼 a       # Print a

Nope. interpreter

哮 a               # Initialize variable a
喳 a               # Input a as string
乒乓 "Nope."       # Print "Nope."
啷 a               # Delete variable a

Truth Machine

哮 x
唧 x
哇 x==0
    乒乓 "0"
咗
    嗖 哕
        乒乓 "1"

See also

Assembly

Categories