PROLOG GRAMMAR-RULE TRANSLATOR Jocelyn Paine Shelved on the 6th of December 1987 (Contribution by Richard O'Keefe sent in July 1988) The entry comes as four files: GRAMMAR.PRE - this file GRAMMAR.PL - the source GRAMMAR_OK.PL - a different translator from Richard O'Keefe GRAMMARBUG1. - a note of suspected bugs from Richard O'Keefe GRAMMARBUG1. is a short message - Richard warns of two bugs which may afflict GRAMMAR.PL. I haven't yet tested it for them. GRAMMAR_OK.PL is a new translator he wrote, which eliminates these and some other bugs. It is commented. Until I examine them properly, that's all I'll say about Richard's files. The rest of this note describes GRAMMAR.PL. This program defines a predicate, 'grexpand', for expanding Definite Clause Grammar Rules into Prolog clauses. These are the standard form of DCG rules, for which a translator is built-in to many Prologs. It also defines 'phrase', for parsing a list according to a grammar rule. It does not contain predicates for reconsulting files and calling 'grexpand' on each term. The translator is essentially the same as that published in "Programming in Prolog", by Clocksin and Mellish. To use the program, call 'grexpand' and 'phrase'! The code may be useful when building other grammar-directed systems, for example, syntax-directed formatters. Note that the program includes 'append' and 'islist'; utilities which you may have elsewhere. CHECKED ON EDINBURGH-COMPATIBLE (POPLOG) PROLOG : yes. PORTABILITY : easy, no known problems. INTERNAL DOCUMENTATION : comments for each predicate, sample output.