Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site decwrl.UUCP Path: utzoo!linus!decvax!decwrl!vantreeck@logic.DEC From: vantreeck@logic.DEC Newsgroups: net.lang.prolog Subject: DCGs + Left Recursion = (:-[) ! Message-ID: <534@decwrl.UUCP> Date: Mon, 23-Sep-85 10:40:31 EDT Article-I.D.: decwrl.534 Posted: Mon Sep 23 10:40:31 1985 Date-Received: Wed, 25-Sep-85 12:43:52 EDT Sender: daemon@decwrl.UUCP Organization: Digital Equipment Corporation Lines: 35 >Newsgroups: net.lang.prolog >Path: decwrl!pyramid!nsc!hplabs!sdcrdcf!ucla-cs!dimare >Subject: DCGs + Left Recursion = (:-[) ! >Posted: 19 Sep 85 23:38:57 GMT >Organization: UCLA Computer Science Department >I'm writing a little parser for a Pascal like language. >I was going to copy Wirth's grammar into a DCG Prolog >program, but I noticed that left recursion can't be used. You are correct in your assertion that most PROLOGs' DCGs do not handle left recursion. That's because they're simple top down parsers. There is a PROLOG DCG parser that uses bottom up parsing (and can handle left recursions). The parser is called BUP. Need I say it stands for Bottom Up Parser? I don't have the references here at work - the papers are a couple of years old. I'm sure your UCLA libarary can do a computer search on BUP. Off the top of my head -- A brief description can be found in a book by Dahl, Natural Language Understanding with Logic - it's a collection of papers from a 1984 symposium in France. The articles I've read on BUP tend to be of the "Gee, isn't this wonderful!" variety, rather than delving into enough implementation detail that someone could use it as a guide to writing a BUP. If anyone finds a paper that gives an in depth description of the implementation details, please post it to the net or send mail! -George