TI-BASIC, 104 107 102 100100 98
For TI-83+/84+ series calculators.
Name this prgmD
; it eventually overflows the stack by calling itself. Replace the recursion with a While 1
, at the cost of two bytes, to fix this.
ZStandard //Sets Y to 0.
Input ">>",Str1
For(I,1,length(Str1
int(.5inString("?ixskd?oc",sub(Str1,I,1
If Ans=4
Disp Y
imag(i^Ans)+Y^int(e^(Ans=2 //decrements when Ans=3; increments when Ans=1
min(0,Ans(Ans≠256→Y
End
prgmD
Y is 0 by default, so either run this with a freshly memory-cleared calculator or store 0 to Y manually before running this.
Too bad that the lowercase letters (in the string literals) are two bytes each; otherwise this would be shorter than Dom Hastings' answer.
EDIT: Fixed a divide-by-zero (0^0) error at the cost of three bytes.
107 -> 102: Used imaginary exponentiation trick to save four bytes (including 1 from parentheses and -1 from lengthening the lookup string) and used Y instead of X, which takes one less byte to initialize.