implementing Prolog VM