Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!bloom-beacon.mit.edu!uhog.mit.edu!news.mathworks.com!udel!gatech!howland.reston.ans.net!pipex!uunet!allegra!ulysses!alice!pereira
From: pereira@alta.research.att.com (Fernando Pereira)
Subject: Re: DCG parsing
In-Reply-To: pedersen@seas.smu.edu's message of Tue, 8 Nov 1994 18:50:49 GMT
Message-ID: <PEREIRA.94Nov10220856@alta.research.att.com>
Sender: netnews@ulysses.homer.att.com (Shankar Ishwar)
Reply-To: pereira@research.att.com
Organization: AT&T Bell Laboratories
References: <1994Nov8.185049.29988@seas.smu.edu>
Date: Fri, 11 Nov 1994 03:08:56 GMT
Lines: 27

In article <1994Nov8.185049.29988@seas.smu.edu> pedersen@seas.smu.edu (Ted Pedersen) writes:
:  Normally DCG grammars are parsed left to right.  What would be involved
: in making a parser that would take a DCG grammar and parse sentences
: right to left?? An example DCG grammar follows:
: [...]
: If you are wondering why the heck I would want to do this: I have a feeling that 
: there may be cases when a parser is dealing with unknown words (ie not in the lexicon)
: that parsing right to left (or maybe both left to right and right to left) would
: have considerable advantages.
I dodn't understand your reasoning. As stated, the problem is
symmetric, there is no reason why unknown words would be harder to
treat left-to-right than right-to-left. It may happen for a particular
grammar there are more constraints on unknown words from the left than
from the right. However, whether this will matter depends on your
particular way of handling unknown words. When I did something of that
kind for a fairly large English grammar, I didn't encounter the
problem you are worrying about.

If you really want to do right-to-left DCG parsing, the simplest way
is to take a standard DCG->Prolog translator and modify it in the
appropriate way. It's a pretty straightforward exercise.
--
Fernando Pereira
2D-447, AT&T Bell Laboratories
600 Mountain Ave, PO Box 636
Murray Hill, NJ 07974-0636
pereira@research.att.com
