Compilation Techniques for Prolog