Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!bloom-beacon.mit.edu!gatech!howland.reston.ans.net!pipex!uunet!seas.smu.edu!pedersen
From: pedersen@seas.smu.edu (Ted Pedersen)
Subject: DCG parsing
Message-ID: <1994Nov8.185049.29988@seas.smu.edu>
Sender: news@seas.smu.edu (USENET News System)
Nntp-Posting-Host: rapid_f.seas.smu.edu
Organization: SMU - School of Engineering & Applied Science - Dallas
Date: Tue, 8 Nov 1994 18:50:49 GMT
Lines: 35


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:

s  --> np, vp.
np --> d,  n.
vp --> v,  np.
d  --> [the].
n  --> [man];[boy].
v  --> [saw].

My first thought would be to reverse the sentence and parse it left
to right. But then I realized that the rules would have to be reversed
as well. I really don't like this reversal idea. 

I'd rather have the rules and the text written left to right and then 
have the parser internally do the work starting at the end of the
sentence rather than the beginning. 

Has anyone done this? Any comments on the above would be appreciated. 

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 suppose there are implications for
parallel parsing as well but I have thought less about that. 

Thanks for any comments,
Ted

---
* Ted Pedersen                                  pedersen@seas.smu.edu * 
* Department of Computer Science and Engineering,                     *
* Southern Methodist University, Dallas, TX 75275      (214) 768-2126 *
