Article View: comp.lang.prolog
Article #2650Re: cut for meta-interpreter
From: raf
Date: Thu, 23 Apr 1987 00:01
Date: Thu, 23 Apr 1987 00:01
31 lines
1811 bytes
1811 bytes
In response to my question for meta-circular interpreter
which includes cut (without the use of ancesstor cut
in the implementation!) Karen A. Morrissey proposes
the "solution" which is just a regular meta-interpeter,
but DOES NOT incorporate cut!
Here is a possible solution which does incorporate cut and
is based on the assumption (which is true for C-prolog)
that cut cuts the goal choice-point rather then the
disjunctive choice-point:
%-------------------------------------------------------
% /* meta-circular interpreter with cut */
%-------------------------------------------------------
% Author: Rafail Ostrovsky 4/20/1987
%-------------------------------------------------------
%
solve(G) :- solve(G,_).
solve(!,X) :- var(X);X=cut.
solve((A,B),C) :- solve(A,C),solve(B,C).
solve(A,C)
:- C==cut;
(system_pred(A),!,A);
(clause(A,B),solve(B,C1),(var(C1);C1==cut,!,fail)).
%-------------------------------------------------------
I do not know how to implement ancesstor cut (see Shapiro and
Sterling book) without the use of ancesstor cut at the meta-level,
and how to implement meta-circular interpreter with cut
without the use of the above assumption.
/raf
Technical Details
Message-ID:
<6867@bu-cs.BU.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!bu-cs!rafReferences:
<6681@bu-cs.BU.EDU> <1861@druhi.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!bu-cs!raf From: raf@bu-cs.UUCP Newsgroups: comp.lang.prolog Subject: Re: cut for meta-interpreter Message-ID: <6867@bu-cs.BU.EDU> Date: Wed, 22-Apr-87 19:01:21 EST Article-I.D.: bu-cs.6867 Posted: Wed Apr 22 19:01:21 1987 Date-Received: Fri, 24-Apr-87 03:51:18 EST References: <6681@bu-cs.BU.EDU> <1861@druhi.UUCP> Organization: Boston U. Comp. Sci. Lines: 31 Keywords: cut,ancestor cut,meta-interperter Summary: a possible solution