Python 3, 138 bytes
Easy translation of the interpreter language instructions:
for i in[len(o)/11for o in input().split(' ')]:
if i==1:a=0
if i==2:a=a+1
if i==3:a=a-1
if i==4:a=a*2
if i==5:a=a/2
if i==6:print(a)
In the first line:
- takes the input
- split the instructions separated by a space
- divide by 11 (the lenght of the base word
interpreter
) to get the corresponding operation
The subsequent if
execute the operations on the accumulator.
EDIT: theoretical improvements, code not modified (see version 2). Anyway, thanks for the suggestions!
-4 bytes thanks to @expressjs123
-3 bytes thanks to @ElPedro
VERSION 2
Python 3, 97 9696 93 bytes
Improved the selection of the instructions simply by using list slicing.
-41 bytes compared to original version.
-1 byte thanks to @ElPedro
-3 bytes thanks to @Zaelin Goodman
a=0
for i in[len(o)//11for o in input().split()]:
a=[0,a+1,a-=[a,-1,a*21,-a,a/2,a][i0][i-1]
if i>5:print(a)