basic state machine for the interpreter