Skip to main content
Log in

Composition and evaluation of attribute coupled grammars

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

With attribute coupled grammars, descriptions of subsequent compilation phases can be composed to a single phase on the description level. This creates the opportunity for independent compiler modularization on the description versus the implementation level. The composition introduces a nontrivial reshaping of attribute dependencies, and hence affects the overall strategy for attribute evaluation. For a hierarchy of evaluation classes reaching from S-attributed to noncircular attribute couplings (ACs), we investigate whether they are closed under composition. Where closure does not hold, we identify subclasses which have the closure property. We show that closure of 1-ordered and simpler classes can only be achieved when there is only a single syntactic attribute allowed, while in the case of absolutely noncircular attribute couplings, an arbitrary number of synthesized syntactic attributes can be used. We show how (suboptimal) evaluators for the composed description are obtained directly from the evaluators of the separate phases. We also investigate the complementary problem of reducing the attribute evaluation complexity of a given, monolithic phase specification by finding an appropriate decomposition into subphases which all belong to simpler evaluation classes. In particular, we find that the closed subclass of sweep-evaluable ACs is generated by a proper subclass ofL-attributed ACs, while a similar characterization of 1-ordered ACs is proved to be impossible. Finally, we relate our observations to known results about descriptive power of attribute grammars and tree transducers.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Goguen, J.A., Thatcher, J.W., Wagner, E.G., Wright, J.B.: Initial algebra semantics and continuous algebras. JACM 24(1), 68–95 (1977)

    Article  MATH  MathSciNet  Google Scholar 

  2. Goguen, J.A., Thatcher, J.W., Wagner, E.G., Wright, J.B.: An initial algebra approach to the specification, correctness, and implementation of abstract data types. In : Yeh, R.T. (ed.) Current trends in programming methodology, pp. 80–149. Englewood Cliffs: Prentice Hall 1978

    Google Scholar 

  3. Thatcher, J.W., Wagner, E.G., Wright, J.B.: More on advice on structuring compilers and proving them correct. Proceedings ICALP 1979. Lecture Notes in Computer Science. Vol. 71. Berlin Heidelberg New York: Springer 1979

    Google Scholar 

  4. Aho, A.V., Ullman, J.D.: The theory of parsing, translation and compiling. Englewood Cliffs: Prentice Hall 1973

    Google Scholar 

  5. Alblas, H.: A characterization of attribute evaluation in passes. Acta Informatica16, pp. 427–464 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  6. Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes (Part I and II). Theor. Comput. Sci.17, 163–191, 235–257 (1982)

    Article  MathSciNet  Google Scholar 

  7. Courcelle, B., Franchi-Zannettacci, P.: On the equivalence problem for attribute systems. Inf. Control52, 275–305 (1982)

    Article  MATH  MathSciNet  Google Scholar 

  8. Courcelle, B.: Attribute grammars: Definitions, analysis of dependencies, proof methods. In [Lorh84]

  9. Davidson, J.W., Fraser, C.W.: Eliminating redundant object code. Proceedings 9th ACM POPL, Albuquerque, pp. 128–132 (1982)

  10. Deransart, P. : Private communication

  11. Deransart, P., Jourdan, M., Lorho, B.: A survey on attribute grammars. Part HI -classified bibliography. Report 417, INRIA (1985)

  12. Deransart, P., Jourdan, M., Lorho, B. : A survey on attribute grammars. Part I -main results on attribute grammars. Report 485, INRIA (1986)

  13. Deransart, P., Jourdan, M., Lorho, B. : A survey on attribute grammars. Part II -review of existing systems. Report 510, INRIA (1986)

  14. Drossopoulos, S., Uhl, J., Persch, G., Goos, G., Dausmann, M., Winterstein, G.: An attribute grammar for semantic analysis of Ada. Lecture Notes in Computer Science. Vol. 139. Berlin Heidelberg New York: Springer 1982

    Google Scholar 

  15. Engelfriet, J., Filè, G.: The formal power of one-visit attribute grammars. Acta Informatica16, 275–302 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  16. Engelfriet, J., Filè, G.: Passes, sweeps and visits. Proceedings 8th ICALP, Lecture Notes in Computer Science. Vol. 115, pp. 193–207. Berlin Heidelberg New York: Springer 1982

    Google Scholar 

  17. Engelfriet, J., Filè, G.: Simple multi-visit attribute grammars. J. Comput. Syst. Sci.24, 283–314(1982)

    Article  MATH  Google Scholar 

  18. Engelfriet, J.: Some open questions and recent results on tree transducers and tree languages. In: Book, R. (ed.) Formal language theory: Perspectives and open problems. New York: Academic Press 1980

    Google Scholar 

  19. Engelfriet, J.: Tree transducers and syntax-directed semantics. Memorandum 363. University Twente (1981)

  20. Engelfriet, J. : Attribute grammars : Attribute evaluation methods. In [Lorh84]

  21. Farrow, R.: Covers of attribute grammars and sub-protocol attribute evaluators. Technical Report, Dept. of Computer Science, Columbia University, New York (1983)

    Google Scholar 

  22. Farrow, R. : Sub-protocol attribute evaluators for attribute grammars. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction. SIGPLAN Notices19, 70–80 (1984)

  23. Filè, G.: Theory of attribute grammars. Dissertation, University Twente (1983)

  24. Filè, G.: Machines for attribute grammars. In [Filè83a]. Also in Inf. Control69, 41–124 (1986)

    Article  MATH  Google Scholar 

  25. Filè, G.: Interpretation and reduction of attribute grammars. In [Filè83a]. Also in Acta Informatica 19, 115–150 (1983)

    Article  MATH  MathSciNet  Google Scholar 

  26. Fülöp, Z.: On attributed tree transducers. Acta Cybern.5, 261–297 (1981)

    MATH  Google Scholar 

  27. Ganzinger, H.: Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Programming3, 223–278 (1983)

    Article  MATH  MathSciNet  Google Scholar 

  28. Ganzinger, H., Giegerich, R.: Attribute coupled grammars. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction. SIGPLAN Notices19, 157–170 (1984)

    Google Scholar 

  29. Ganzinger, H., Giegerich, R., Möncke, U., Wilhelm, R.: A truly generative semanticsdirected compiler generator. Proceedings ACM SIGPLAN ’82 Symposium on Compiler Construction. SIGPLAN Notices1b7, 172–184 (1982)

  30. Ganzinger, H., Giegerich, R., Vach, M. : MARVIN — A tool for applicative and modular compiler specifications. Report 220, University Dortmund (1986)

  31. Glasner, I, Möncke, U., Wilhelm, R.: OPTRAN, a language for the specification of program transformations. In: Hoffman, H.-J. (ed) GI6. Fachtagung, Informatik Fachberichte. Vol. 25, pp. 125–142. Berlin Heidelberg New York: Springer 1980

    Google Scholar 

  32. Ganzinger, H., Ripken, K., Wilhelm, R.: Automatic generation of optimizing multipass compilers. Proceedings IFIP ’77, Toronto, Gilchrist, B. (ed.), pp. 353–340. Amsterdam Oxford New York: Elsevier-North Holland 1977

    Google Scholar 

  33. Hecht, M.S.: Flow analysis of computer programs. Amsterdam Oxford New York: Elsevier-North Holland 1977

    MATH  Google Scholar 

  34. Heeg, G., de Vries, E.: LINGUA — ein Compiler-Generator. Diplomarbeit, University Dortmund (1980)

    Google Scholar 

  35. RÄihÄ, K.-J., Saarinen, M., Soisalon-Soininen, E., Tienari, M.: The compiler writing system HLP (Helsinki Language Processor). Report A-1978-2, Dept. of Computer Science, University of Helsinki (1978)

  36. Huet, G., Oppen, D.: Equations and rewrite rules: A survey. In: Book, R. (ed.) Formal language theory: Perspectives and open problems. New York: Academic Press 1980

    Google Scholar 

  37. Huet, G., Hullot, J.-M.: Proofs by induction in equational theories with constructors. Proceedings 21st Annual Symposium in Foundations of Computer Science, Lake Placid, pp. 96–107 (1980)

  38. Jazayeri, M., Walter, K.G.: Alternating semantic evaluator. Proceedings ACM 75 Annual Conference, pp. 230–234 (1975)

  39. Jochum : Automatische Konstruktion und einheitliche Darstellung von Attributauswertungsalgorithmen. Dissertation, Report TUM-INFO-8113, Technical University Munich (1981)

  40. Gazayeri, M., Odgen, W.F., Rounds, W.C.: The intrinsical exponential complexity of the circularity problem for attribute grammars. CACM18, 679–706 (1975)

    Google Scholar 

  41. Jones, N.D., Tofte, M.: Some principles and notations for the construction of compiler generators. Unpublished working paper, DIKU, Copenhagen (1983)

  42. Jourdan, M. : Strongly noncircular attribute grammars and their recursive evaluation. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction, SIGPLAN Notices19, 81–93 (1984)

  43. Kastens, U.: Ordered attribute grammars. Acta Informatica13, 229–256 (1980)

    Article  MATH  MathSciNet  Google Scholar 

  44. Kastens, U., Hutt, B., Zimmermann, E.: GAG: A practical compiler generator. Lecture Notes in Computer Science. Vol. 141. Berlin Heidelberg New York: Springer 1982

    MATH  Google Scholar 

  45. Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theor. 2(2), 127–145 (1968)

    Article  MATH  MathSciNet  Google Scholar 

  46. Knuth, D.E.: Semantics of context-free languages: Correction. Math. Syst. Theor.5, 95–96(1971)

    Article  MATH  MathSciNet  Google Scholar 

  47. Knuth, D.E.: Examples of formal semantics. In: Engeler, E. (ed.) Symposium on Semantics of Algorithmic Languages, Lecture Notes in Mathematics, pp. 212–232. Berlin Heidelberg New York: Springer 1971

    Google Scholar 

  48. Kennedy, K., Warren, S.K.: Automatic generation of efficient evaluators for attribute grammars. Proceedings 3rd ACM POPL, pp. 32–49 (1976)

  49. Lecarme, O., Bochman, G.V.: A (truly) usable and portable compiler writing system. Proceedings IFIP ’74, Rosenfeld, J.L. (ed.), pp. 218–221. Amsterdam, Oxford, New York: North Holland 1974

    Google Scholar 

  50. Lorho, B.: Semantic attributes processing in the system DELTA. In : Ershov, A., Koster, C.H.A. (ed.) Methods of algorithmic language implementation, Lecture Notes in Computer Science. Vol. 47, pp. 21–40. Berlin Heidelberg New York: Springer 1977

    Google Scholar 

  51. Lorho, B. (ed.): Methods and tools for compiler construction. Cambridge: Cambridge University Press 1984

    MATH  Google Scholar 

  52. Lewis, P.M., Rosenkrantz, D.J., Stearns, R.E.: Attributed translations, JCSS9, 279–307 (1974)

    MATH  MathSciNet  Google Scholar 

  53. Mamrak, S.A., Kaelbling, M.J, Nicholas, C.K., Share, M.: A software architecture for supporting the exchange of electronic manuscripts. CACM30, 408–414 (1987)

    Google Scholar 

  54. Morris, F.L.: Advice on structuring compilers and proving them correct. Proceedings 1st ACM POPL, pp. 144–152 (1973)

  55. Wilhelm, R., Ripken, K., Ciesinger, J., Lahner, W., Nollmann, R.D. : Design evaluation of the compiler generating system MUG1. Proceedings 2nd Int. Conference on Software Engineering, San Francisco, pp. 571–576 (1976)

  56. Parigot, D. : Practical transformation of strongly non-circular attribute grammars into l-ordered ones. Manuscript, INRIA (1987)

  57. Paulson, L.: A semantics directed compiler generator. Proceedings 9th ACM POPL, Albuquerque, pp. 224–233 (1982)

  58. RÄihÄ, K.-J., Ukkonen, E.: Minimizing the number of evaluation passes for attribute grammars. SIAM J. Comput.10, 772–786 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  59. Riis-Nielson, H.: Computation sequences : A way to characterize subclasses of attribute grammars. Acta Informatica19, 255–268 (1983)

    Article  MathSciNet  Google Scholar 

  60. Storz, M.: Der Farrow-Auswerter — Vorbereitung der Implementation. Diplomarbeit, Technical University Munich (1985)

    Google Scholar 

  61. Vach, M.: MARVIN — ein Modula 2-basierter Compiler-Compiler. Diplomarbeit, University Dortmund (1985)

    Google Scholar 

  62. Wadler, P.L. : Listlessness is better than lazyness : lazy evaluation and garbage collection at compile time. ACM Symposium on Lisp and Functional Programming, Austin (1986)

  63. Wadler, P.L.: Listlessness is better than lazyness II: Composing listless functions. In: Ganzinger, H., Jones, N.D. (ed.) Programs as data objects. Lecture Notes in Computer Science. Vol. 271, pp. 282–305. Berlin Heidelberg New York: Springer 1984

    Google Scholar 

  64. Wilhelm, R.: Codeoptimierung mittels attributierter Transformationsgrammatiken. GI 4. Jahrestagung, Lecture Notes in Computer Science, pp. 257–266. Berlin Heidelberg New York: Springer 1974

    Google Scholar 

  65. Yellin, D.M.: Attribute grammar inversion and source-to-source translation. Dissertation, Columbia University, New York (1987)

    Google Scholar 

  66. Yellin, D.M., Mueckstein, E.-M.: The automatic inversion of attribute grammars. IEEE Trans. Software Eng. SE-12, 590–599 (1986)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Giegerich, R. Composition and evaluation of attribute coupled grammars. Acta Informatica 25, 355–423 (1988). https://doi.org/10.1007/BF02737108

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF02737108

Keywords

Navigation