From junaidsidd@usa.net  Wed Nov 22 22:21:48 2000
Received: from aw162.netaddress.usa.net (aw162.netaddress.usa.net [204.68.24.62])
	by swi.psy.uva.nl (8.9.3/8.9.3) with SMTP id WAA27274
	for <prolog@swi.psy.uva.nl>; Wed, 22 Nov 2000 22:21:47 +0100 (MET)
Received: (qmail 28975 invoked by uid 60001); 22 Nov 2000 21:21:48 -0000
Message-ID: <20001122212148.28974.qmail@aw162.netaddress.usa.net>
Received: from 204.68.24.62 by aw162 for [149.99.14.16] via web-mailer(34FM.0700.4.03) on Wed Nov 22 21:21:48 GMT 2000
Date: 22 Nov 00 16:21:48 EST
From: j s <junaidsidd@usa.net>
To: "Richard A. OKeefe" <ok@atlas.otago.ac.nz>
Subject: Re: [Re:  parsing using difference lists]
X-Mailer: USANET web-mailer (34FM.0700.4.03)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by swi.psy.uva.nl id WAA27274

> You Read The Fine Textbook.

I'm not sure what this means. 

> expn(S) :-
>     expn(S, _, S, []).
> 
> expn(D0, D, S0, S) :-
>     nomen(D0, D, S0, S).
> expn([_,_|D0], D, [the|S0], S) :-
>     reln(D0, D1, S0, [of|S1]),
>     expn(D1, D, S1, S).
> expn([_|D0], D, S0, S) :-
>     expn(D0, D1, S0, [poss|S1]),
>     expn(D1, D, S1, S).
> 
> reln([_|D], D, [W|S], S) :-
>     ( W = mother ; W = sister  ; W = daughter
>     ; W = father ; W = brother ; W = son
>     ).
> 
> nomen([_|D], D, [W|S], S) :-
>     ( W = jack ; W = jill ).
> 

Question1:

Hmm. Now what if I wanted to extend this parser to build parse trees. I mean
say I wanted to write a predicate parseTree(E,Tree) that succeeds iff E is a
List, the expression represented by E is accepted by the grammar, and Tree is
the parse tree that the grammar generates for E. For instance, if E is
[the,mother,of,junaid], Tree should be
"expn(the,reln(mother),of,expn(name(junaid)))". Or say, E is
[the,son,of,bod,poss,aunt], which would have a parse Tree
"expn(expn(the,reln(son),of,expn(name(bod))),poss,reln(aunt))".  (Note that I
am using non-terminal from the grammar as the functor name). 

This is actually what I eventually wanted to do, but I thought that this task
was a by-product of writing a parser. Anyhow, my question (as in previous
para) is what do I do now to build a parse tree. (maybe extend the parser??).


Question2:

Finally, if I wanted to write a predicate interpret(E,Tree,Person) that
succeeds iff E is a list, the expression represented by E is accepted by the
grammar, Tree is the parse tree that the grammar generates for E, and Person
is a person referred to by that expression. 

Of course in order to determine who is "the brother of michael poss aunt", for
example, I will need a database of facts and rules about people and their
relationships. I have already written some facts for people who male(X),
female(X), and parent(X,Y) predicates for fact. And also defined the
relationship predicates mother, sister, brother, etc. 

thanx. 

____________________________________________________________________
Get free email and a permanent address at http://www.amexmail.com/?A=1

