From a-doug@microsoft.com  Tue Jun 20 16:50:21 2000
Received: from mail2.microsoft.com (mail2.microsoft.com [131.107.3.124])
	by swi.psy.uva.nl (8.9.3/8.9.3) with SMTP id QAA23448
	for <prolog@swi.psy.uva.nl>; Tue, 20 Jun 2000 16:50:20 +0200 (MET DST)
Received: from 157.54.9.104 by mail2.microsoft.com (InterScan E-Mail VirusWall NT); Tue, 20 Jun 2000 07:49:59 -0700 (Pacific Daylight Time)
Received: by INET-IMC-02 with Internet Mail Service (5.5.2651.58)
	id <N2G3RJ1P>; Tue, 20 Jun 2000 07:49:58 -0700
Message-ID: <E713F2760348D211A9B600805F6FA1AB05676B86@RED-MSG-09.itg-messaging.redmond.corp.microsoft.com>
From: "Douglas Miles (Volt Computer)" <a-doug@microsoft.com>
To: "Douglas Miles (Volt Computer)" <a-doug@microsoft.com>,
        prolog@swi.psy.uva.nl
Subject: RE: unifying terms with a DCG syntax
Date: Tue, 20 Jun 2000 07:50:08 -0700
X-Mailer: Internet Mail Service (5.5.2651.58)

Oh thats right.. silly me

that the Clause is a term starting with ','/2 usually

So i have my answer,

Parsing down the DCG right hand side by collecting terms out of ','/2

thanks,
Douglas



-----Original Message-----
From: Douglas Miles (Volt Computer) [mailto:a-doug@microsoft.com]
Sent: Thursday, June 08, 2000 5:32 PM
To: prolog@swi.psy.uva.nl
Subject: unifying terms with a DCG syntax


I have a question about unifying terms with a DCG syntax

like In this case... of this example

%%%%%%%%%%%%%%%%%%
:-retractall(dcg_macro(_)).
:-see('O:/output/espg.dcg'),repeat,read(Datum),app(Datum),Datum=end_of_file,
seen.

app(end_of_file):-!.
app((Macro-->CLAUSES)):-!,
		retractall(dcg_macro(Macro)),
		assert(dcg_macro(Macro)),
		expand_term((Macro-->CLAUSES),Prolog),
		assert(Prolog),
		split_dcg_clause(CLAUSES,Terms,Conditions),
		assert(dcg_tree(Macro,Terms,Conditions)).

app(Prolog):-!,assert(Prolog).


split_dcg_clause( ( Terms,{Conditions} ) , Terms, Conditions):-!.
split_dcg_clause( Terms, Terms, true ):-is_list(Terms),!.
split_dcg_clause( ( Terms,{} ) , Terms, true ):-is_list(Terms),!.
% ....
% ....
%%%%%%%%%%%%%%%%%%


You can easily see how my   split_dcg_clause/2 is not sufficient.

but I am not sure if there is an easy way to do this already?
Any way better then an everycase senario ;>


/* dcg files contains... */

sayable(avatar(Avatar)) --> [Avatar],
	{if(avatar(Avatar))}.
sayable(location(Name)) --> [at],sayable(Name), {nonvar(Name)}.
sayable(thing_part(Avatar,Part)) --> sayable(Part),[of],sayable(Avatar),
	{
	nonvar(Avatar),nonvar(Part)
	}.

	%	sayable(bodypart(Part)),[of],sayable(avatar(Avatar)),
	%		{if(bodypart(Part)),if(avatar(Avatar))}.

sayable(pthing(Thing))--> [a,Thing],
	{if(pthing(Thing))}.
sayable(athing(Thing))--> [a,Thing],
        {if(athing(Thing))}.

sayable(sense_organ(Sense)) --> [the,Sense],
	{if(sense_organ(Sense))}.
sayable(bodypart(Bpart))-->[Bpart],
	{if(bodypart(Bpart))}.

sayable(Anything) --> [Anything],{ground(Anything)}.


----------------
* To UNSUBSCRIBE, please use the HTML form at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist

or send mail to prolog-request@swi.psy.uva.nl using the Subject:
"unsubscribe"
(without the quotes) and *no* message body.

** An ARCHIVE of this list is maintained at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/

