Compiling typol with attribute grammars

  • Isabelle Attali
Attribute Grammars In Logic Programming
Part of the Lecture Notes in Computer Science book series (LNCS, volume 348)


We have shown in a previous paper that TYPOL specifications and Attribute Grammars are strongly related: we presented a general construction to build an Attribute Grammar from a TYPOL program. Thus, it was possible to use AG techniques to replace, during TYPOL specifications execution, run-time unification by semantic attribute evaluation.

We go on now with this transfer of expertise between Logic Programming and Attribute Grammars applying AG techniques to the TYPOL domain. The purpose of this paper is twofold. First, we show that TYPOL can be viewed as a higher-level Attribute Grammar definition language, owing to unification; thus, evaluating TYPOL specifications with an automatically-generated attribute evaluator provides straightforwardly efficiency in both time and space, and incrementality. Second, we develop a method to partially evaluate TYPOL specifications. This method is based on the abstract interpretation of the dependency graph of semantic attributes associated with TYPOL variables.


Logic Program Inference Rule Dependency Graph Partial Evaluation Abstract Syntax 
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. [1]
    Aho A., Sethi R., & Ullman J. “Compilers: Principles, Techniques, and Tools” Addison-Wesley, Reading, Mass., 1986Google Scholar
  2. [2]
    Attali I. & Franchi-Zannettacci P. “Prolog-like schemes for Ada static semantics” Ada UK news, 6, 2, 1985Google Scholar
  3. [3]
    Attali I. & Franchi-Zannettaci P. “Unification-free Execution of TYPOL Programs by Semantic Attribute Evaluation”, Proceedings Fifth International Conference Symposium on Logic Programming, Seattle, August 1988, MIT Press.Google Scholar
  4. [4]
    Berry G. & Sethi R. “From regular expressions to deterministic automata” TCS 48, 1, 1986Google Scholar
  5. [5]
    Bochmann G. “Semantic evaluation from left to right” CACM 19, 2, 55–62, 1976Google Scholar
  6. [6]
    Borras P., Clément D., Despeyroux T., Incerpi J., Kahn G., Lang B., & Pascual V. “CENTAUR: the system” INRIA research report 777, 1987. To be published in proc. of SIGSOFT'88, Third Annual Symposium on Software Development Environments, Boston, 1988Google Scholar
  7. [7]
    Bruynooghe M. “ A Framework for the abstract interpretation of logic programs” Katholoeke Universiteit Leuven, Report CW 62, 1987Google Scholar
  8. [8]
    Chirica L. & Martin D. “An order algebraic definition of Knuthian semantics” Math. Systems Theory 13, 1979Google Scholar
  9. [9]
    Clément D., Despeyroux J., Despeyroux T., & Kahn G. “A simple applicative language: Mini-ml” Symp. on Functional Programming Languages and Computer Architecture, 1986Google Scholar
  10. [10]
    Courcelle B. & Franchi-Zannettacci P. “Attribute Grammars and Recursive Program Schemes” TCS 17, 163, 1980Google Scholar
  11. [11]
    Demers A., Reps T. & Teitelbaum T. “Incremental evaluation for attribute grammars with application to syntax-directed editors” in Conference Record of the 8th ACM Symposium on Principles of Programming Languages, Williamsburg, Va, 1981Google Scholar
  12. [12]
    Deransart P. & Maluszynski J. “Relating Logic Programs and Attribute Grammars” J. Logic Programming 2:119–155, 1985Google Scholar
  13. [13]
    Deransart P., Jourdan M., & Lorho B. “Attribute Grammars: Definitions, Systems and Bibliography” LNCS 323, Spinger Verlag, 1988Google Scholar
  14. [14]
    Despeyroux T. “Executable Specification of static semantics” Semantics of Data Types, LNCS 173, 1984Google Scholar
  15. [15]
    Despeyroux T. “TYPOL: a formalism to implement Natural Semantics” INRIA research report 94, 1988Google Scholar
  16. [16]
    Donzeau-Gouge V., Kahn G., & Lang B. “A complete machine checked definition of a simple programming language using denotational semantics” INRIA research report 330, 1978Google Scholar
  17. [17]
    Drabent W. “Do logic programs resemble programs in conventional languages ?” 1987 IEEE Symp. on Logic Programming, San Francisco, 1987Google Scholar
  18. [18]
    Engelfriet J. & File G. “The formal power of one-visit attribute grammars” Proc. of the seventh ICALP, LNCS 85, 1980Google Scholar
  19. [19]
    Ershov A. P. “On the partial computation principle” Information Processing Letters, 6–2, 1977Google Scholar
  20. [20]
    Franchi-Zannettacci P. “Attributs sémantiques et schémas de programmes” Thèse d'Etat, Univ. of Bordeaux I, 1982Google Scholar
  21. [21]
    Fumatura Y. “Generalised Partial Computation” Proc. workshop on Partial Evaluation and Mixed Computation, Denmark, Oct 1987. Also New Generation Computing Journal, Vol. 6, Nos 2 & 3, 1988.Google Scholar
  22. [22]
    Ganzinger H. & Hanus M. “Modular Logic Programming of Compilers” Proc. Symp. on Logic Programming, Boston, Massachusetts, 242–253, 1985Google Scholar
  23. [23]
    Hascöet L. “Partial evaluation with inference rules” Proc. workshop on Partial Evaluation and Mixed Computation, Denmark, Oct 1987. Also New Generation Computing Journal, Vol. 6, Nos 2 & 3, 1988.Google Scholar
  24. [24]
    Johnsson T. “Attribute Grammars as a Functional Programming Paradigm” Symp. on Functional Programming Languages and Computer Architecture LNCS 274, Portland, 1987Google Scholar
  25. [25]
    Jones N. D., Setsoft P. & Sondergaard H. “MIX: a self-applicable partial evaluator for experiments in compiler generation”, report 87/8, DIKU, University of Copenhagen, 1987Google Scholar
  26. [26]
    Jourdan M. “Strongly Non-Circular Attribute Grammars and their recursive evaluation” ACM Sigplan Symp. on Compiler Construction, Montreal Sigplan Notices 19, 6, 1984Google Scholar
  27. [27]
    Jourdan M. & Parigot D. “The FNC-2 system: advances in Attribute Grammar Technology” INRIA research report to be published, 1988Google Scholar
  28. [28]
    Julié C. “Optimisation de l'espace mémoire pour les compilateurs générés selon la méthode d'évaluation OAG: Etude des travaux de Kastens et propositions d'améliorations” Rapport de DEA, Univ. of Orléans, 1986Google Scholar
  29. [29]
    Kahn G. “Natural Semantics” Proc. of Symp on Theoretical Aspects of Computer Science, Passau, Germany, LNCS 247, 1987Google Scholar
  30. [30]
    Kastens U. “Ordered Attribute Grammars” Acta Informatica 13, 1980Google Scholar
  31. [31]
    Kastens U. “The GAG-system — A Tool for Compiler Construction” in Methods and Tools for Compiler Construction, ed B. Lorho, 165–182, Cambridge University Press, 1984Google Scholar
  32. [32]
    Kennedy K. & Warren S. K. “Automatic generation of efficient evaluators for Attribute Grammars” Proc. of the 3rd ACM Conf on Principle of Programming Languages, Atlanta, 1976Google Scholar
  33. [33]
    Knuth D. E. “Semantics of Context-Free Languages” Math. Syst. Theory 2, 1968Google Scholar
  34. [34]
    Komorowski H. J. & Maluszynski J. “Unification-free execution of logic programs” 1985 IEEE Symp. on Logic Programming, Boston, 1985Google Scholar
  35. [35]
    Lang B. “The Virtual Tree Processor” in Generation of Interactive Programming Environments, Intermediate Report, J. Heering, J. Sidi, A. Verhoog (Eds), CWI Report CS-R8620, Amsterdam, May 1986Google Scholar
  36. [36]
    Naish L. “Negation and Control in Prolog” LNCS 238, 1986Google Scholar
  37. [37]
    Plotkin G. D. “A structural approach to operational semantics” Report DAIMI FN-19, Computer Science Dpt, Aarhus Univ., Aarhus, Denmark, 1981Google Scholar
  38. [38]
    Prawitz D. “Ideas and results in proof theory” Proc. of the Second Scandinavian Logic Symposium, North Holland, 1971Google Scholar
  39. [39]
    Reddy U. S. “On the relationship between logic and functional languages” in Logic Programming: Functions, Relations and Equations, DeGroot D., Lindstrom G. eds., Prentice Hall, 1986Google Scholar
  40. [40]
    Reps T. “Generating Language based Environments” M.I.T. Press, Cambridge, Mass, 1984Google Scholar
  41. [41]
    Sethi R. “Complete Register Allocation problems” SIAM J. Comp 4, 1975Google Scholar
  42. [42]
    Sethi R. & Ullman J. “The generation of optimal code for arithmetic expressions” JACM 17, 4, 1970Google Scholar
  43. [43]
    Tavernini V. E. “Translating Natural Semantic Specifications to Attribute Grammars” Master's Thesis, University of Illinois, Urbana-Champaign, 1987Google Scholar
  44. [44]
    Uhl J., Drossopoulou S., Persch G., Goos G., Dausmann M., & Winterstein G. “An Attribute Grammar for the semantic analysis of Ada” LNCS 149, 1982Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Isabelle Attali
    • 1
  1. 1.Sophia-AntipolisINRIAValbonne CedexFrance

Personalised recommendations