Attribute grammars and logic programs: A comparison of concepts

  • Jan Małuszyński
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 545)


The paper presents a unified view of attribute grammars and definite logic programs that allows for comparison of concepts and techniques used in both fields. A common basic notion of both formalisms is that of labelled tree. The semantics of attribute grammars can be defined in terms of decorated parse trees while the semantics of logic programs can be defined in terms of proof trees. The comparison of concepts shows that attribute grammars have several features not present in definite logic programs. These are: the concept of the language derived, many-sorted types, the notion of dependency relation and the notion of semantic domain with the semantic functions. After having identified these differences we mention some extensions proposed in the field of logic programming, which essentially amount to enriching definite programs with these features. The conclusion of this discussion is that a possible common denominator for logic programs and attribute grammars is the concept of constraint logic program. As a justification of this comparative study the paper gives references to the results obtained by transfer of methods between attribute grammars and logic programs.


Logic Program Logic Programming Operational Semantic Parse Tree Derivation 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. [Abr84]
    H. Abramson. Definite Clause Translation Grammars. In Proceedings Int. Symp. on Logic Programming, pages 233–240, Atlantic City, 1984. IEEE.Google Scholar
  2. [AD89]
    H. Abramson and V. Dahl. Logic Grammars. Springer-Verlag, 1989.Google Scholar
  3. [AFZ88]
    I. Attali and P. Franchi-Zanettaci. Unification-free execution of TYPOL programs by semantic attribute evaluation. In Proceedings of PLILP'88, Orleans, 1988. LNCS 348.Google Scholar
  4. [Alb91]
    H. Alblas. Attribute evaluation methods. In this volume, 1991.Google Scholar
  5. [Apt87]
    K. Apt. Introduction to Logic Programming. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science: Formal Models and Semantics, volume B, chapter 10, pages 493–574. Elsevier, 1987.Google Scholar
  6. [Arb86]
    B. Arbab. Compiling circular attribute grammars into Prolog. IBM J. of Research and Development, 30(3):294–309, 1986.Google Scholar
  7. [BM88]
    S. Bonnier and J. Małuszyński. Towards a Clean Amalgamation of Logic Programs with External Procedures. In Proc. of PLILP '88, pages 311–326. Springer-Verlag, 1988.Google Scholar
  8. [Bon91]
    S. Bonnier. Weakly Complete Unification for the use of Functions in Logic Programs. Proc. MFCS, to appear LNCS, 1991.Google Scholar
  9. [Bor86]
    Borland, Int., Scotts Valley. Turbo Prolog owner's handbook, 1986.Google Scholar
  10. [Boy91]
    J. Boye. Operational completeness of logic programs with external procedures. Master's thesis, Linkőping University, 1991. LiTH-IDA-Ex-9104.Google Scholar
  11. [CD88]
    D. Courcelle and P. Deransart. Proofs of partial correctness for attribute grammars with application to recursive procedures and logic programming. Information and Computation, 78(sn1), 1988.Google Scholar
  12. [Col78]
    A. Colmerauer. Metamorphosis Grammars. In L. Bolc, editor, Natural Language Communication with Computers, pages 133–189. LNCS 63, Springer-Verlag, 1978.Google Scholar
  13. [Der89]
    P. Deransart. Proofs of declarative properties of logic programs. In Springer-Verlag, editor, Proceedings of TAPSOFT, Barcelona, 1989. LNCS 352.Google Scholar
  14. [Der90]
    P. Deransart. Proof methods of declarative properties of logic programs. Research Report 1248, INRIA, 1990.Google Scholar
  15. [DFT91]
    P. Deransart, G. Ferrand, and M. Teguia. Not subject to occur-check programs. INRIA, March 1991.Google Scholar
  16. [DM83]
    P. Deransart and J. Małuszyński. Modelling data dependencies in logic programs by attribute grammars. Research Report 323, INRIA, 1983.Google Scholar
  17. [DM85]
    P. Deransart and J. Małuszyński. Relating Logic Programs and Attribute Grammars. Journal of Logic Programming, 2(2):119–156, 1985.CrossRefGoogle Scholar
  18. [DM90]
    P. Deransart and J. Małuszyński. What kind of grammars are logic programs? In P. Saint-Dizier and S. Szpakowicz, editors, Logic and Logic Grammars for Language Processing, chapter 2, pages 29–55. Ellis Horwood, 1990.Google Scholar
  19. [DM91]
    P. Deransart and J. Małuszyński. A Grammatical View of Logic Programming. A draft of the book in preparation, 1991.Google Scholar
  20. [Dra87]
    W. Drabent. Do logic programs resemble programs in conventional languages? In Proceedings, 1987 Symposium on Logic Programming, pages 389–396. IEEE Computer Society Press, 1987.Google Scholar
  21. [Hei87]
    N. Heintze et. al. The CLP(ℜ) Programmers Manual (version 2.0). Technical report, Dept. of Computer Science, Monash University, 1987.Google Scholar
  22. [Hen88]
    P.R. Henriques. A semantic evaluator generating system in Prolog. In Proc. of PLILP'88. Springer-Verlag, 1988. LNCS 348.Google Scholar
  23. [Hen89]
    P. Van Hentenryck. Constraint Satisfaction in Logic Programming. The MIT-Press, 1989.Google Scholar
  24. [JL87]
    J. Jaffar and J-L. Lassez. Constraint Logic Programming. In Conf. Record of 14th Annual ACM Symp. on POPL, 1987.Google Scholar
  25. [KK91]
    A. Kågedahl and F. Kluźniak. Enriching Prolog with S-unification. Research report, Linkőping University, 1991. LiTH-IDA-R-91-12.Google Scholar
  26. [Knu68]
    D.E. Knuth. Semantics of Context-Free Languages. Mathematical Systems Theory, 2, 1968.Google Scholar
  27. [Kos91]
    K. Koster. Affix grammars for compiler construction. in this volume, 1991.Google Scholar
  28. [Llo87]
    J.W. Lloyd. Foundations of Logic Programming. Springer-Verlag, second edition, 1987.Google Scholar
  29. [Nil83]
    J.F. Nilsson. On the compilation of domain-based prolog. In R.E.A. Mason, editor, Information Processing 83, pages 293–298. North Holland, 1983.Google Scholar
  30. [Nil86]
    U. Nilsson. AID: An Alternative Implementation of DCGs. New Generation Computing, 4(4):383–399, 1986.Google Scholar
  31. [NM90]
    U. Nilsson and J. Małuszyński. Logic, Programming and Prolog. John Wiley & Sons, 1990.Google Scholar
  32. [Paa90]
    J. Paaki. A logic-based modification of attribute grammars for practical compiler writing. In D.H.D. Warren and P. Szeredi, editors, Proc. of the 7th Int. Conf. on Logic Programming, pages 203–217. MIT Press, 1990.Google Scholar
  33. [RL88]
    G. Riedewald and U. Lammel. Using an attribute grammar as a logic program. In Proc. of PLILP'88, Orleans, 1988.Google Scholar
  34. [Wij65]
    A. Van Wijngaarden. Orthogonal design and description of a formal language. MR 76, Matematisch Centrum, Amsterdam, 1965.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Jan Małuszyński
    • 1
  1. 1.Department of Computer and Information ScienceLinkőping UniversityLinkőping

Personalised recommendations