Lost is a 2 dimensional language in which the start location and direction are entirely random
The memory is stored in a stack and a scope. Both are stacks padded with zeros at the bottom. At the end of execution the contents of the stack are printed.
Unlike most 2D languages the ip may start in any location moving in any direction. When the ip reaches an edge it will wrap to the other side (like a torus).
-
\
Swaps the x and y directions -
/
Swaps the x and y directions and multiplies them by -1 -
|
Multiplies the horizontal direction by -1
-
>
Tells the ip to move east -
<
Tells the ip to move west -
v
Tells the ip to move south -
^
Tells the ip to move north
-
[
Reflects the ip if it is moving east; becomes]
if the ip is moving horizontally -
]
Reflects the ip if it is moving west; becomes[
if the ip is moving horizontally
-
!
Skips the next operation -
?
Pops off the top of the stack and jumps if not zero
-
:
Duplicates the top of the stack -
$
Swaps the top two items of the stack -
(
Pops from the stack and pushes to the scope -
)
Pops from the scope and pushes to the stack
-
0
-9
pushes n to the top of the stack -
"
Starts and ends a string literal. During a string literal commands are not run and instead their character values are pushed to the stack.
-
+
Adds the top two numbers -
*
Multiplies the top two numbers -
-
Multiplies the top by -1
-
%
Turns the safety off -
#
Turns the safety on -
@
Ends execution if the safety is off (starts on)