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.
Similar content being viewed by others
References
Goguen, J.A., Thatcher, J.W., Wagner, E.G., Wright, J.B.: Initial algebra semantics and continuous algebras. JACM 24(1), 68–95 (1977)
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
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
Aho, A.V., Ullman, J.D.: The theory of parsing, translation and compiling. Englewood Cliffs: Prentice Hall 1973
Alblas, H.: A characterization of attribute evaluation in passes. Acta Informatica16, pp. 427–464 (1981)
Courcelle, B., Franchi-Zannettacci, P.: Attribute grammars and recursive program schemes (Part I and II). Theor. Comput. Sci.17, 163–191, 235–257 (1982)
Courcelle, B., Franchi-Zannettacci, P.: On the equivalence problem for attribute systems. Inf. Control52, 275–305 (1982)
Courcelle, B.: Attribute grammars: Definitions, analysis of dependencies, proof methods. In [Lorh84]
Davidson, J.W., Fraser, C.W.: Eliminating redundant object code. Proceedings 9th ACM POPL, Albuquerque, pp. 128–132 (1982)
Deransart, P. : Private communication
Deransart, P., Jourdan, M., Lorho, B.: A survey on attribute grammars. Part HI -classified bibliography. Report 417, INRIA (1985)
Deransart, P., Jourdan, M., Lorho, B. : A survey on attribute grammars. Part I -main results on attribute grammars. Report 485, INRIA (1986)
Deransart, P., Jourdan, M., Lorho, B. : A survey on attribute grammars. Part II -review of existing systems. Report 510, INRIA (1986)
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
Engelfriet, J., Filè, G.: The formal power of one-visit attribute grammars. Acta Informatica16, 275–302 (1981)
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
Engelfriet, J., Filè, G.: Simple multi-visit attribute grammars. J. Comput. Syst. Sci.24, 283–314(1982)
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
Engelfriet, J.: Tree transducers and syntax-directed semantics. Memorandum 363. University Twente (1981)
Engelfriet, J. : Attribute grammars : Attribute evaluation methods. In [Lorh84]
Farrow, R.: Covers of attribute grammars and sub-protocol attribute evaluators. Technical Report, Dept. of Computer Science, Columbia University, New York (1983)
Farrow, R. : Sub-protocol attribute evaluators for attribute grammars. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction. SIGPLAN Notices19, 70–80 (1984)
Filè, G.: Theory of attribute grammars. Dissertation, University Twente (1983)
Filè, G.: Machines for attribute grammars. In [Filè83a]. Also in Inf. Control69, 41–124 (1986)
Filè, G.: Interpretation and reduction of attribute grammars. In [Filè83a]. Also in Acta Informatica 19, 115–150 (1983)
Fülöp, Z.: On attributed tree transducers. Acta Cybern.5, 261–297 (1981)
Ganzinger, H.: Increasing modularity and language-independency in automatically generated compilers. Sci. Comput. Programming3, 223–278 (1983)
Ganzinger, H., Giegerich, R.: Attribute coupled grammars. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction. SIGPLAN Notices19, 157–170 (1984)
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)
Ganzinger, H., Giegerich, R., Vach, M. : MARVIN — A tool for applicative and modular compiler specifications. Report 220, University Dortmund (1986)
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
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
Hecht, M.S.: Flow analysis of computer programs. Amsterdam Oxford New York: Elsevier-North Holland 1977
Heeg, G., de Vries, E.: LINGUA — ein Compiler-Generator. Diplomarbeit, University Dortmund (1980)
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)
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
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)
Jazayeri, M., Walter, K.G.: Alternating semantic evaluator. Proceedings ACM 75 Annual Conference, pp. 230–234 (1975)
Jochum : Automatische Konstruktion und einheitliche Darstellung von Attributauswertungsalgorithmen. Dissertation, Report TUM-INFO-8113, Technical University Munich (1981)
Gazayeri, M., Odgen, W.F., Rounds, W.C.: The intrinsical exponential complexity of the circularity problem for attribute grammars. CACM18, 679–706 (1975)
Jones, N.D., Tofte, M.: Some principles and notations for the construction of compiler generators. Unpublished working paper, DIKU, Copenhagen (1983)
Jourdan, M. : Strongly noncircular attribute grammars and their recursive evaluation. Proceedings ACM SIGPLAN ’84 Symposium on Compiler Construction, SIGPLAN Notices19, 81–93 (1984)
Kastens, U.: Ordered attribute grammars. Acta Informatica13, 229–256 (1980)
Kastens, U., Hutt, B., Zimmermann, E.: GAG: A practical compiler generator. Lecture Notes in Computer Science. Vol. 141. Berlin Heidelberg New York: Springer 1982
Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theor. 2(2), 127–145 (1968)
Knuth, D.E.: Semantics of context-free languages: Correction. Math. Syst. Theor.5, 95–96(1971)
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
Kennedy, K., Warren, S.K.: Automatic generation of efficient evaluators for attribute grammars. Proceedings 3rd ACM POPL, pp. 32–49 (1976)
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
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
Lorho, B. (ed.): Methods and tools for compiler construction. Cambridge: Cambridge University Press 1984
Lewis, P.M., Rosenkrantz, D.J., Stearns, R.E.: Attributed translations, JCSS9, 279–307 (1974)
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)
Morris, F.L.: Advice on structuring compilers and proving them correct. Proceedings 1st ACM POPL, pp. 144–152 (1973)
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)
Parigot, D. : Practical transformation of strongly non-circular attribute grammars into l-ordered ones. Manuscript, INRIA (1987)
Paulson, L.: A semantics directed compiler generator. Proceedings 9th ACM POPL, Albuquerque, pp. 224–233 (1982)
RÄihÄ, K.-J., Ukkonen, E.: Minimizing the number of evaluation passes for attribute grammars. SIAM J. Comput.10, 772–786 (1981)
Riis-Nielson, H.: Computation sequences : A way to characterize subclasses of attribute grammars. Acta Informatica19, 255–268 (1983)
Storz, M.: Der Farrow-Auswerter — Vorbereitung der Implementation. Diplomarbeit, Technical University Munich (1985)
Vach, M.: MARVIN — ein Modula 2-basierter Compiler-Compiler. Diplomarbeit, University Dortmund (1985)
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)
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
Wilhelm, R.: Codeoptimierung mittels attributierter Transformationsgrammatiken. GI 4. Jahrestagung, Lecture Notes in Computer Science, pp. 257–266. Berlin Heidelberg New York: Springer 1974
Yellin, D.M.: Attribute grammar inversion and source-to-source translation. Dissertation, Columbia University, New York (1987)
Yellin, D.M., Mueckstein, E.-M.: The automatic inversion of attribute grammars. IEEE Trans. Software Eng. SE-12, 590–599 (1986)
Author information
Authors and Affiliations
Rights 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
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF02737108