the machine has stack and 7 instructions
-
push # push a number on to the stack
-
pop # pop off the first number on the stack
-
add # pop off the top 2 items on the stack and push their sum on to the stack. (remember you can add negative numbers, so you have subtraction covered too). You can also get multiplication my creating a loop using some of the other instructions with this one.
-
ifeq
# examine the top of the stack, if it's 0, continue, else, jump to where is a lable -
jump
# jump to a lable -
print # print the value at the top of the stack
-
dup # push a copy of what's at the top of the stack back onto the stack.
svm [filename]