A Slow Language

From Esolang
Jump to navigation Jump to search

A Slow Language is a 2D Befunge-like esoteric programming language made for a Truttle1 Esolang Jam. You control a turtle on an infinite grid. And since turtles are slow, it randomly takes 1 to 3 seconds before it moves on to another cell.

Instructions

When any value on the stack is used by an instruction, it gets popped! Only in popping mode, which is internally on. *You can toggle it with a dot. (.)

Character Function
r Sets the turtle's direction to right.
l Sets the turtle's direction to left.
u Sets the turtle's direction to up.
d Sets the turtle's direction to down.
= Performs IF condition. If the top value matches the value below it, it moves right, otherwise it moves left.
| Same as equals to, but when the top values match, it moves up, otherwise down.
_ If there's no value on a stack, it moves to the left, otherwise it moves right
! Same as underscore, but it performs it vertically like the pipe instruction.
? Chooses a random direction to walk in.
" Toggle stack pushing mode. In stack pushing mode, the turtle pushes any character's ASCII value onto the stack.
Any hexadecimal number from 0 to F (letters must be uppercase) Pushes a number onto the stack.
v Pops a value from the stack.
^ Pushes a the current top value onto the stack (Duplicate)
~ Reverses the stack
O Prints the top value on the stack as an ASCII character.
o Prints the top value on the stack as a number.
I Reads user input as ASCII characters and pushes the values onto the stack.
i Reads user input as number and pushes the value onto the stack.
+ Adds the top 2 values on the stack together and pushes the result.
- Subtracts the top 2 values on the stack together and pushes the result.
* Mutliplies the top 2 values on the stack together and pushes the result.
/ Divides the top 2 values on the stack together and pushes the result.
% Modules the top 2 values on the stack together and pushes the result.
x Ends this program.
. Toggles popping mode.
: Reads/Writes into a register. More info in the Register section.

Register

Register is used as another form of data storage. It can be written or read from. Register is identified with a character after the : instruction. When the register is empty (contains no value), it is written to from the top value in the stack (then popped if in popping mode). If it contains a value, then it will push it's value onto the stack and marks it as empty.

Examples

Hello World

r"Hello, World!"~d l
                x_Ou
89*OAA*1+OAA*8+^OOAA*A+1+O4A*4+O84*OA8*7+OAA*A+1+^O3+OAA*8+OAA*O84*1+O

Truth Machine

ri1 d
 xo0=r1od
     u  l

Cat Program

rI~d l
  x_Ou

Interpreter

Changes

  • Added new instruction: "." - Toggle popping mode
  • Added new instruction: ":" - Reads/Writes into a register. More info in the Register section.