An esoteric programming language written in Lua where you have to have manners. Latest version: v1.0.1.
For Twist (YSWS) if you want to use the version at the end of submission, click here, but for the latest commit (recommended: nesting, more stability) click here. If you do use the Twist version, do note that system is slightly different - the README can guide you.
- Lines must end with
pleaseorpls - Arithmetic can only be done in variables
Some of these functions are by design and intended to make experimenting with this programming language more difficult.
You can find the releases here, but for an actual guide, see How to Run EsoHype - how_to_run.md or the official Wiki page.
It is required to have please or pls where it is required on the line, otherwise the interpreter will refuse to parse it. For example:
can my_string be "Works!" please # Will work
display my_string pls
can another_string be "Uh oh!" # Won't work
display another_string plsTo print out strings, numbers, or variables, you can use display. This function only contains one argument, which is what you want to print out. For example:
display 5 pls # 5
display 2 * 7 pls # 14
display "this works!" pls # this works!Variables can also be used.
can x be 27 pls
display x pls # 27However, the following example below will not work:
display 5
This is because it is missing the please or pls keyword at the end of the line.
To define variables, you need to ask the interpreter to define it, for example:
can x be 5 plswhere x is the variable name and 5 is the value you want to set it to, for example, a number.
Variables can be used almost anywhere, for example, in display statements:
can y be 27 pls
display y pls # Outputs 27They can also contain strings:
can y be "this works!" pls
display y plsas well as basic arithmetic:
can z be 5 * (2 + 5) pls
display z plsand they can also be mutable (reassigned).
can x be 27 / 2 pls
display x pls # 13.5
can x be 5 * 5 pls
display x pls # 25NOTE: As of version v1.0.0, arithmetic may only be done in variables.
can x be 25 pls
repeat x times (pls)
display "This will happen 25 times!" pls
endrepeat (pls)Repeat loops are blocks of code that repeat a certain amount. They start with repeat x times where x is the number or variable, and end with endrepeat. Repeat loops can be nested inside other blocks (e.g. if, funk, repeat) (as of v1.0.1!)
You may set the repeat count to a number:
repeat 5 times pls
display "Repeated 5 times!" pls
endrepeat plsOr you may also set it to be a numeric variable:
can count be 7 pls
repeat count times pls
display "Repeated 7 times!" pls
endrepeat plsIf you do set the count to be a numeric variable, it is possible to do this:
can x be 5 pls
repeat x times
can x be x + 1 pls
display x pls
endrepeat plsHowever, instead of running indefinitely until stopped, EsoHype will only grab the count provided when the repeat block is initialised (or initialized), resulting in this output below:
6
7
8
9
10
Indents are not needed inside a repeat block as they will be ignored by the interpreter, but they make the code easier to read.
Repeating indefinitely is also possible, for example:
can x be 1 pls
repeat
wait 1 seconds pls
can x be x * 2 pls
display x pls
endrepeatindefinite_multiply.hyp - Using indefinite repeat blocks to multiply a number
The above code will keep multiplying x by 2 until stopped (Ctrl+C). After a while, you may see the integers going into the negatives, this is a limitation of integers and how Lua handles it.
NOTE: Do not have a indefinite repeat block without something yielding it! This means, for example, wait. Otherwise, this may crash your device.
Functions are blocks of code that can be repeated as many times as you wish. Functions can be nested inside other blocks (e.g. if, funk, repeat) (as of v1.0.1!)
To define a function, use the keyword funk, then the name of the function (e.g. sum) followed by the arguments you wish to provide (don't forget pls or please at the end). For example:
funk sum first second pls
endfunkNote that all functions must end with endfunk, otherwise the rest of the script may fail to execute correctly.
In this example, first is our first argument (the first number) and second is our second argument (the second number) that will be used when we add them both together.
Since arithmetic can only be handled in variables, let's create a variable, in this case x, as a temporary variable to do the addition.
funk sum first second pls
can x be first + second pls
endfunkWe're adding together both first and second as numbers.
Finally, let's print the result to the user and call the function:
funk sum first second pls
can x be first + second pls
display x pls
endfunk pls
call sum 5 5 plsNote the last line - call sum. The two numbers there are the arguments that we provided (first and second), and call sum executes the function named sum.
Running this inside the console, we get this as output:
10
Check out the example here: get_sum.hyp - Sum of two numbers using a function
An if statement compares one value to another, and if it is true, executes code inside the block. If statements can be nested inside other blocks (e.g. if, funk, repeat) (as of v1.0.1!)
For example:
can x be 10 pls
if x > 5 pls
display "x is greater than 5!" pls
endifNote that all if blocks must end with endif otherwise the script may not run correctly.
It does not necessarily have to be a variable that you're comparing, for example:
if 10 > 5 pls
display "10 is still greater than 5!"
endifif_block.hyp - Basic example of comparing two values
You can also compare strings as well.
You may use these operator signs in if blocks.
< less than
> greater than
<= less than or equal to
=> greater than or equal to
~= not equal to
== equals
input lets you read user input and stream it to a variable. For example:
can x be input pls
display x plsinput yields the script until the user has submitted entry.
It must be stored into a variable.
For example:
can x be input as number pls
if x == 5 pls
display "x is 5!" pls
endif plsNotice the keywords as number - the same can be applied for as string.
However, if you want to display what x (the input variable) is, converting it to a number or a string is generally not needed as display prints either.
fibonacci.hyp - Fibonacci sequence
takeoff.hyp - Count down from 5 to 0 (takeoff) using a repeat block
get_sum.hyp - Sum of two numbers using a function
if_block.hyp - Basic example of comparing two values
indefinite_multiply.hyp - Using indefinite repeat blocks to multiply a number
advanced_fib.hyp - fibonacci.hyp but requires user input
nested_repeat.hyp - Example of nesting repeat blocks
nested_funk.hyp - A somewhat insane way of nesting
To execute any of these examples in your terminal, simply type lua esohype.lua examples/<name>.hyp, for example lua esohype.lua examples/takeoff.hyp. This assumes esohype.lua is in the same folder as examples.
If you're using Windows/prebuilt binaries, the equivalent is esohype.exe examples/<name>.hyp.
AI was used to make some of the logic, particularly complicated ones like if statements and functions. However, the main base of the programming language was made by me with AI sprinkles on top (basically).