Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!EU.net!sun4nl!freya.let.rug.nl!let.rug.nl!gosse
From: gosse@let.rug.nl (Gosse Bouma)
Subject: Re: Strings in DCG-style Chart Parsing
Sender: news@let.rug.nl (News system at let.rug.nl)
Message-ID: <1995Oct3.095758.26601@let.rug.nl>
Date: Tue, 3 Oct 1995 09:57:58 GMT
References: <441e71$dp7@hobbes.cc.uga.edu> <PEREIRA.95Sep30104755@alta.research.att.com>
Nntp-Posting-Host: hela.let.rug.nl
Organization: Faculty of Arts, University of Groningen
Lines: 45

In article <PEREIRA.95Sep30104755@alta.research.att.com>,
pereira@alta.research.att.com (Fernando Pereira) writes:
 
> A bit of history. Colmerauer's original logic grammar formalism,
> metamorphosis grammars, depended on the list representation of string
> positions, because it allowed symbols to be pushed back into the input
> stream, with rules such as
> 
> 	a, [b] --> c, d.
> 
> We coined the name "definite clause grammars" for the subset of
> metamorphosis grammars lacking that possibility, which has the
> property of not depending on the list representation. 

The possibility of `pushing symbols back into the input string' is still
available in sicstus. A while ago I was fiddling with term_expansion to get
another representation for DCG's and found that the sicstus manual actually
includes the following example of a dcg rule:

is(N), [not] --> [aint].

which is expanded to

is(N,S0,[not|S]) :- 'C'(S0,aint,S).


It is not so clear to me what the use of this particular mechanism is.
The example is apparently intended to illustrate a particular analysis of
negated auxiliaries in English. If anybody has ideas for other uses of this
mechanism (that have some (computational) linguistic appeal), I would like to
hear about them.

All I could think of (in the off-beat uses for DCG's section) is a 
exotic way to compute the maximum element of a list of numbers:

max(M) --> [M].
max(M) --> compare_two, max(M).

compare_two, [Max] --> [El1,El2], {El1 > El2 -> Max = El1 ; Max = El2}.

The query max(M,[1,2,3],[]) instantiates M as 3.

-- 
Gosse Bouma, Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
gosse@let.rug.nl       tel. +31-50-635937       fax  +31-50-635979
