Re: Prolog implementation, in case you haven't already found it, the book Warren's Abstract Machine: A Tutorial Reconstruction, by Hassan Aït-Kaci, is pure gold for understanding the WAM.
http://web.archive.org/web/20030213072337/http://www.vanx.or...