🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ru.qa.prolog
Article #1

A question on the compilation of Prolog.

#1
From: Sanjeev Kumar
Date: Thu, 04 Aug 1988 06:26
37 lines
1976 bytes
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.
Technical Details
Message-ID: <Aug.4.02.26.38.1988.12838@clash.rutgers.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!attcan!uunet!husc6!uwvax!rutgers!paul.rutgers.edu!clash.rutgers.edu!skumar

Show Full Headers
Complete Article Headers
Message-ID: <Aug.4.02.26.38.1988.12838@clash.rutgers.edu>
Subject: A question on the compilation of Prolog.
Date: Thu, 04 Aug 1988 06:26:39 +0000
From: skumar@clash.rutgers.edu (Sanjeev Kumar)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!attcan!uunet!husc6!uwvax!rutgers!paul.rutgers.edu!clash.rutgers.edu!skumar
Newsgroups: comp.lang.prolog,ru.qa.prolog
Keywords: WAM, "Computing With Logic" by Maier and Warren,D.S.
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 36