This project provides an interpreter for "simply script", a super-simple scripting language (inspired by Assembly) that is mostly used for coding puzzles.
"simply script" supports the following commands:
set |register| |value|
Sets the value (32-bit integer) of the indicated register. Register names can be any combination of letters, numbers, and underscore characters, but must start with a letter. This command essentially serves the purpose of assigning a value to a variable.
cpy |register 1| |register 2|
Copies the value from |register 1| to |register 2|.
add |register 1| |register 2|
Adds the value stored in |register 1| to the value stored in |register 2|. Stores the final value in |register 2|.
sub |register 1| |register 2|
Subtracts the value stored in |register 1| from the value stored in |register 2|. Stores the final value in |register 2|.
jmp |register|
The next line to execute will be the line whose value is stored in |register|. Attempting
to jump to a line number less than 1
will result in a NegativeExecutionPointer
error.
jwz |register 1| |register 2|
Check the value in |register 1|. If that value is 0
, continue execution at the line
number stored in |register 2|. Otherwise, continue execution with the next line.
jnz |register 1| |register 2|
Check the value in |register 1|. If that value is not 0
, continue execution at the
line number stored in |register 2|. Otherwise, continue execution with the next line.
gth |register 1| |register 2|
If the value stored in |register 1| is greater than |register 2|, store 1
in
|register 2|, otherwise, store -1
in |register 2|.
lth |register 1| |register 2|
If the value stored in |register 1| is less than |register 2|, store 1
in
|register 2|, otherwise, store -1
in |register 2|.
out |register|
Print the value stored in |register| to standard out.
Just write your "simply script" into a text file (like "file.simply") and run the
script with simply file.simply
.