EchoLang

From Esolang
Jump to navigation Jump to search

EchoLang is an esolang created by I rember in February 2023. It's kind of a mix between ><> and BASIC. It is stack-based, tape-based, AND variable-based, but mostly stack-based.

Here are the commands:

Command Description
{any number} Push a number onto the stack.
"{string}" Push a letter's ASCII value onto the stack. If the string is more than one letter long, each value will be pushed individually.
pop Pop a value off the stack and discard it.
shout Pop and print as a number.
say Pop and print as text.
add Pop a and b, push a+b.
subtract Pop a and b, push b-a.
multiply Pop a and b, push b*a.
divide Pop a and b, push b/a.
modulo Pop a and b, push b%a.
and Pop a and b, and if both are 1, push 1; if not, push 0.
or Pop a and b, and if either or both are 1, push 1; if not, push 0.
not Pop, if the value is 0, push 1; if not, push 0.
equal Pop a and b, and if a=b, push 1; if not, push 0.
greater Pop a and b, and if b>a, push 1; if not, push 0.
less Pop a and b, and if b<a, push 1; if not, push 0.
listen Push user's input.
reverse Reverse the stack.
swap Swap the top two items on the stack.
label() Define a label.
goto() Go to a label.
goif() Pop, and go to a label if the value is 1.
gosub() Go to a label as a subroutine.
subif() Pop, and go to a label as a subroutine if the value is 1.
return Return from a subroutine.
returnif Pop, and return from a subroutine if the value is 1.
locate Pop, and set the position on the tape to popped value.
location Push position on the tape.
read Push value at position on the tape.
write Pop, and set the value at position on the tape to popped value.
var() Define a variable.
get() Push a variable's value.
set() Pop, and set a variable's value to popped value.

If you attempt to read a value that doesn't exist (e.g. popping when the stack is empty; getting the value of a variable that doesn't exist) or divide by zero, the interpreter will read it as -1.

Programs

Truth Machine

listen
goif()
shout
label()
shout
goto()

Made by ZachChecksOutEsolangs (talk)