A grammatical view of logic programming

  • Pierre Deransart
  • Jan Maluszynski
Attribute Grammars And Logic Programming
Part of the Lecture Notes in Computer Science book series (LNCS, volume 348)


We presented a grammatical view of logic programming where logic programs are considered grammars. This gives a natural framework for defining extensions to the concept of logic program. The paper shows that many useful extensions of Horn clauses incorporated in Prolog without theoretical justification correspond to well-established grammatical concepts. In particular the notion of DCG is a special case of W-grammar, modes are related to dependency relation of AG's, domain declarations of Turbo Prolog can be seen as a metagrammar of W-grammar and Prolog arithmetics fits naturally in the framework of RAG's with non-term interpretations. The grammatical point of view shows also a possibility of further extensions, not incorporated in Prolog, like a natural use of external procedures in logic programs. It also opens for the use of “grammatical techniques” like parsing or attribute evaluation in implementation of logic programs. On the other hand, the comparison of the formalisms shows that resolution techniques can be used for some grammars which were considered practically intractable, like RAG's or W-grammars. Last but not least, the grammatical point of view makes it possible to apply in logic programming some proof techniques developed originally for proving correctness of attribute grammars.


Logic Program Logic Programming Production Rule Operational Semantic Parse Tree 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [Abr 84]
    Abramson H.: Definite Clause Translation Grammar, International Symposium on Logic Programming, Atlantic City, IEEE, pp 233–240, 1984.Google Scholar
  2. [AF 88]
    Attali I., Franchi-Zannettacci P.: Unification-free Execution of TYPOL Programs by Semantic Attribute Evaluation. PLILP'88, Orléans, France, May 16–18, 1988.Google Scholar
  3. [Arb 86]
    Arbab B.: Compiling Circular Attribute Grammars into Prolog, Journal of Research Development, 30 3, pp 294–309, May 1986.Google Scholar
  4. [BM 88]
    Bonnier S., Maluszynski J.: Toward Clean Amalgamation of Logic Programs with External Procedures, PLILP'88, Orléans, France, May 16–18, 1988.Google Scholar
  5. [Bo 86]
    Turbo Prolog Owner's Handbook, Borland Int., Scotts Valley, 1986.Google Scholar
  6. [CD 87]
    Courcelle B., Deransart P.: Proofs of Partial Correctness for Attribute Grammars with Application to Recursive Procedures and Logic Programming, RR I-8702, University of Bordeaux (to appear in Information and Computation 1988).Google Scholar
  7. [CH 87]
    Cohen J., Hickey T.J.: Parsing and Compiling Using Prolog, ACM Trans. on Progr. Lang. and Systems, 9 2, pp 125–163, April 1987.Google Scholar
  8. [Cla 79]
    Clark K.L.: Predicate Logic as a Computational Formalism, Res. Mon. 79/59, TOC, Imperial College, December 1979.Google Scholar
  9. [Col 78]
    Colmerauer A.: Metamorphosis Grammar, LNCS 63, pp 133–189, Springer Verlag, (Bolc L. ed.), 1978.Google Scholar
  10. [Der 88]
    Deransart P.: PROLOG: Basic Concepts and Methodology: Commented Exercises (french), University of Orléans, to appear, 1988.Google Scholar
  11. [Der 88b]
    Deransart P.: Proof of declarative properties of Logic Programs, INRIA report (to appear).Google Scholar
  12. [Der 88c]
    Deransart P.: On the Multiplicity of Operational Semantics for Logic Programming and their Modelization by Attribute Grammars. INRIA Report 1988 (to appear).Google Scholar
  13. [DF 87a]
    Deransart P., Ferrand G.: Logic Programming with Negation: Formal Presentation (in french), RR 87-3, Laboratoire d'Informatique, University of Orléans, June 1987.Google Scholar
  14. [DF 87b]
    Deransart P., Ferrand G.: An Operational Formal Definition of PROLOG, comprehensive version. RR 763, INRIA Rocquencourt, December 1987.Google Scholar
  15. [DF 88]
    Deransart P., Ferrand G.: Logic Programming: Methodology and Teaching, 2nd French-Japan Symposium, Cannes, Nov 1987, North-Holland 1988.Google Scholar
  16. [DJL 88]
    Deransart P., Jourdan M., Lorho B.: Attribute Grammars: Main Results, Existing Systems and Bibliography. LNCS 323, Springer Verlag, August 1988 (first edition: A Survey on Attribute Grammars, INRIA RR 485, 510, 417).Google Scholar
  17. [DM 84]
    Deransart P., Maluszynski J.: Modelling Data Dependencies in Logic Programs by Attribute Schemata, INRIA RR 323, July 1983.Google Scholar
  18. [DM 85]
    Deransart P., Maluszynski J.: Relating Logic Programs and Attribute Grammars, J. of Logic Programming 1985,2, pp 119–155.Google Scholar
  19. [Dra 87]
    Drabent W.: Do Logic Programs Resemble Programs in Conventional Languages, Proc. of IEEE SLP'87, San Francisco, September 1987.Google Scholar
  20. [DrM 87]
    Drabent W., Maluszynski J.: Inductive Assertion Method for Logic Programs. CFLP 87, Pisa, Italy, March 22–27 1987.Google Scholar
  21. [FLM 88]
    Falashi M., Levi G., Martelli M., Palamidessi C.: A new Declarative Semantics for Logic Languages. Dipartimento di informatica, University of Pisa, Italy. LP'88, Seattle, August 1988.Google Scholar
  22. [Hen 88]
    Henriques P.R.: A Semantic Evaluator Generating System in Prolog, PLILP'88, Orléans, May 16–18, 1988.Google Scholar
  23. [Hog 84]
    Hogger C.J.: Introduction to Logic Programming, APIC Studies in Data Processing 21, Academic Press, 1984.Google Scholar
  24. [HS 85]
    Hsiang J., Srivas M.: Prolog based Inductive Theorem Proving, LNCS 206, Springer Verlag, pp 129–149, Dec. 85.Google Scholar
  25. [JLM 84]
    Jaffar J., Lassez J.L., Maher M.J.: A theory of complete logic programs with equality, Journal of Logic Programming, 1984/3, pp 211–223.Google Scholar
  26. [Kan 86]
    Kanamori T.: Soundness and Completness of Extended Execution for Proving Properties of Prolog Programs. TR 175 ICOT, 1986.Google Scholar
  27. [Knu 68]
    Knuth, D.E.: Semantics of Context-Free Languages, Math. Systems Theory 2 (1968), pp 127–145.Google Scholar
  28. [LBM 88]
    Leszczylowski J., Bonnier S. and Maluszynski J.: Logic Programming with External Procedures: Introducing S-Unification, IPL 27, 1988, pp 159–165.Google Scholar
  29. [Llo 87]
    Lloyd J.W.: Foundations of Logic Programming, Springer, 2nd edition, December 1987 (first 1984).Google Scholar
  30. [Mal 84]
    Maluszynski J.: Towards a Programming Language based on the Notion of Two-level Grammar, TCS 28 (1984) pp 13–43.Google Scholar
  31. [MN 82a]
    Maluszynski J., Nilsson J.F.: Grammatical Unification, IPL 15 (1982), pp 150–158.Google Scholar
  32. [MN 82b]
    Maluszynski J., Nilsson J.F.: A Comparison of the Logic Programming Language PROLOG with Two-level Grammars, in: Van Caneghem, ed., First Int. Logic Programming Conf., pp 193–199, Marseille 1982.Google Scholar
  33. [MN 82b]
    Maluszynski J., Nilsson J.F.: A Version of PROLOG based on the Notion of Two-Level Grammar, in: J. Komorowski (ed) PROLOG Programming Environments, Proc. of the Workshop, Linköping University 1982Google Scholar
  34. [MTH 83]
    Matsumoto Y., Tanaka H., Hirakawa and al.: BUP: a Bottom Up Parser embedded in Prolog, New generation Computing, 1, 1983.Google Scholar
  35. [Näs 87]
    Näslund T.: An experimental implementation of a compiler for two-level grammars, in: Z.W.Ras and M. Zemankova (eds.), Proc. of the 2nd Int. Symposium, Methodologies for Intelligent Systems, pp 424–431, North-Holland 1987.Google Scholar
  36. [Ni 83]
    Nilsson J.F.: On the Compilation of a Domain-based Prolog, in: R.E.A. Mason, ed., Information Processing 83, pp 293–298, North-Holland 1983.Google Scholar
  37. [Nil 86]
    Nilsson U., AID: an Alternative Implementation of DCG's, New Generation Computing 4, pp 383–399, 1986.Google Scholar
  38. [PW 80]
    Pereira F.N.C., Warren D.H.D.: Definite Clause Grammars for Language Analysis: a Survey of the Formalism and Comparison with Augmented Transition Networks. Artificial Intelligence, 13–3, pp 231–278, 1980.Google Scholar
  39. [PW 83]
    Pereira F.N.C., Warren D.H.D.: Parsing as Deduction, 21st Annual Meeting of the Ass. for Computational Linguistics (Cambridge, Mass.), pp 137–144, June 1983.Google Scholar
  40. [Sie 85]
    Siekmann J.H.: Universal Unification, in Proc. of the 7th Int. Conf. on Automated Deduction, R.E.Shostak, ed., LNCS 169, Springer-Verlag, 1984.Google Scholar
  41. [UOK 84]
    Uehara K., Ochitani R., Kakusho O., Toyoda J.: A Bottom Up Parser Based on Predicate Logic: a Survey of the Formalism and its Implementation Technique, ISLP, Atlantic City, pp 220–227, 1984.Google Scholar
  42. [Wij 65]
    Van Wijngaarden A.: Orthogonal Design and Description of a Formal Language, MR 76, Mathematisch Centrum, Amsterdam, 1965.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Pierre Deransart
    • 1
  • Jan Maluszynski
    • 2
  1. 1.Domaine de VoluceauINRIALE CHESNAY CedexFrance
  2. 2.DCISLinköping UniversityLINKÖPINGSweden

Personalised recommendations