EvilStack is a stack-based programming language that has familiar syntax and has similar commands to assembly. It is still in development and is not yet feature-complete. It is made for fun and educational purposes.
The features for heap and memory access are not yet implemented.
-
push
- Pushes the value to the stack -
pop
- Pops the value from the stack -
dup
- Duplicates the top value from the stack -
swap
- Swaps the top two values from the stack
-
add
- Adds the top two values from the stack -
sub
- Subtracts the top value from the second top value -
mul
- Multiplies the top two values from the stack -
div
- Divides the second top value by the top value -
mod
- Divides the second top value by the top value and pushes the remainder
-
atoi
- Converts the top string value from the stack to an integer -
ftoi
- Converts the top float value from the stack to an integer
-
<label>:
- Labels are used to mark a position in the program -
cmp
- Compares the top two values from the stack -
jmp @<label>
- Jumps to the label -
jeq @<label>
- Jumps to the label if the top two values are equal -
jne @<label>
- Jumps to the label if the top two values are not equal -
jgt @<label>
- Jumps to the label if the second top value is greater than the top value -
jlt @<label>
- Jumps to the label if the second top value is less than the top value -
jge @<label>
- Jumps to the label if the second top value is greater than or equal to the top value -
jle @<label>
- Jumps to the label if the second top value is less than or equal to the top value -
ret
- Returns from a subroutine -
exit
- Exits the program
-
print
- Prints the top value from the stack -
read
- Reads a value from the input and pushes it to the stack
-
rand
- Pushes a random number to the stack