We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
SaSH
Jump to navigation
Jump to search
SaSH (acronym of "Stacking and Smiling Hard") is a stack-based esolang created by User:Ezya* that was made for testing a small stack-based language.
Functionality
SaSH uses:
- A list to store items on the stack
- A dictionary to store variables if they have been popped off the stack
Commands
| Command | Description | Example (assume print is added after if not in) |
|---|---|---|
0-9 |
Pushes the number onto the stack | 9 (stack is now [9])
|
any symbol that isn't a number |
Pushes text onto the stack, quotations in code optional | Hello or "Hello"(result would be Hello)
|
= |
Pops a variable and value and stores the variable in the dictionary | value 5 = (result is {value: 5})
|
+ |
Pops the two values at the top of the stack and performs addition | 9 6 + (result is obviously 15)
|
- |
Pops the two values at the top of the stack and performs subtraction | 9 6 - (result is obviously 3)
|
* |
Pops the two values at the top of the stack and performs multiplication | 9 6 * (result is obviously 54)
|
/ |
Pops the two values at the top of the stack and performs division | 15 5 / (result is 3.0)
|
==, <, != |
Pops the two values at the top of the stack and performs a comparison and pushes a Boolean value | 3 10 < (result is True)
|
input |
Takes user input and adds it to the top of the stack | 3 input + (if input entered was 6, result would be 9)
|
print |
If the top of the stack is a number, the number is printed, however if it is a variable, it checks the dictionary to get the value of the variable to print | x 5 = x print (result is "5" because x is equal to 5)
|
select |
Duplicates the nth item of the stack (number ordering like a Python list) | 10 20 30 0 select (result is "10" because 10 is the item at index 0)
|
type |
Pops the value at the top and pushes its type ("number", "text") | 1 type (result is "number")
|
if & endif |
Conditional statement, if item on top of the stack is equal to True, it reads it until endif. If not, it skips until endif |
5 5 == if "Yes" print endif (result is "Yes")
|
loop & endloop |
Loops code, loop marks the start of the loop. endloop pops the top value of the stack. If the top of the stack is True, it loops back to loop, if False, it exits the loop |
i 0 = loop i print i i 1 + = i 3 < endloop (result is 0, 1, 2)
|
Examples
Hello, World!
"Hello World!" print
A+B
a input = b input = b a + print
XKCD Random Number
4 print