Path: utzoo!utgpu!attcan!uunet!husc6!uwvax!rutgers!paul.rutgers.edu!clash.rutgers.edu!skumar From: skumar@clash.rutgers.edu (Sanjeev Kumar) Newsgroups: comp.lang.prolog,ru.qa.prolog Subject: A question on the compilation of Prolog. Keywords: WAM, "Computing With Logic" by Maier and Warren,D.S. Message-ID: Date: 4 Aug 88 06:26:39 GMT Organization: Rutgers Univ., New Brunswick, N.J. Lines: 36 I have a doubt to clarify from an example that is given in the book mentioned above. This is an example on pages 470-471. The example has been given in the context of trimming environments for a clause. The whole example and the insruction in doubt are as follows: (WPE is another name for WAM) Prolog Source WPE Machine Code p(A,D) :- p: alloc q(A,B), r(B,C), getVar r2, 2 % D is first in frame s(C,D). putVar r2, 4 % B is last in frame call q:, 5 % space for D,C,B putUVal r1, 4 % B to r1 putVar r2, 3 % C is second in frame call r:, 4 % space for D,C /*****/ ----------> putVal r1, 3 % C to r1 putVal r2, 2 % D to r2 dealloc exec s: My objection is to the instruction marked by /*****/. I think it should be "putUVal r1, 3" for the same reason as putUVal has been used for B. C might still be unbound after the call to r, and since we are deallocating the frame for the clause before the call to s:, C becomes unsafe. All explanations are welcome. Apart from the doubt mentioned above, I found the section on the WAM (#11.8) very useful and well written. Sanjeev Kumar. -- Sanjeev Kumar. ( skumar@paul.rutgers.edu ) Phone: Off. (201)932-3766, Res. (201)878-1841. Dept. of Computer Science, RUTGERS, New Brunswick, NJ08903.