Code for interpreter in prolog