Summary
The classical attribute grammar framework can be extended by allowing the specification of tree transformation rules. A tree transformation rule consists of an input template, an output template, enabling conditions which are predicates on attribute instances of the input template, and re-evaluation rules which define the values of attribute instances of the output template. A tree transformation may invalidate attribute instances which are needed for additional transformations.
In this paper we investigate whether consecutive tree transformations and attribute re-evaluations are safely possible during a single pass over the derivation tree. This check is made at compiler generation time rather than at compilation time.
A graph theoretic characterization of attribute dependencies is given, showing in which cases the recomputation of attribute instances can be done in parallel with tree transformations.
Similar content being viewed by others
References
Alblas, H.: A characterization of attribute evaluation in passes. Acta Inf. 16, 427–464 (1981)
Alblas, H.: Finding minimal pass sequences for attribute grammars. SIAM J. Comput. 14, 889–914 (1985)
Alblas, H.: Incremental simple multi-pass attribute evaluation. Proc. NGI/SION Symposium 1986, 319–342 (1986)
Babich, W.A., Jazayeri, M.: The method of attributes for data flow analysis, Part I. Exhaustive analysis. Acta Inf. 10, 245–264 (1978)
Bochmann, G.V.: Semantic evaluation from left to right. Commun. ACM 19, 55–62 (1976)
Demers, A., Reps, T., Teitelbaum, T.: Incremental evaluation for attribute grammars with application to syntax-directed editors. Proc. Eighth ACM Symp. Principles Programm. Lang., pp. 105–116 (1981)
DeRemer, F.L.: Transformational grammars. In: Compiler construction: An Advanced Course. Bauer, F.L., Eickel, J. (eds), Lect. Notes Comput. Sci., Vol. 21, pp. 121–145. Berlin-Heidelberg-New York: Springer 1974
Engelfriet, J.: Attribute grammars: Attribute Evaluation Methods. In: Methods and Tools for Compiler Construction, pp. 103–138. Cambridge University Press 1984
Ganzinger, H., Giegerich, R.: A truly generative semantics directed compiler generator. In: Proc. SIGPLAN 1982 Symposium on Compiler Construction. SIGPLAN Notices 17, 6 172–184 (1982)
Giegerich, R., Möncke, U., Wilhelm, R.: Invariance of approximative semantics with respect to program transformations. In: Informatik-Fachberichte, Vol. 50, pp. 1–10. Berlin-Heidelberg-New York: Springer 1981
Glasner, I., Möncke, U., Wilhelm, R.: OPTRAN, a language for the specification of program transformations. In: Informatik-Fachberichte, Vol. 34, pp. 125–142. Berlin-Heidelberg-New York: Springer 1980
Jazayeri, M., Ogden, W.F., Rounds, W.C.: The intrinsically exponential complexity of the circularity problem for attribute grammars. Commun. ACM 18, 697–706 (1975)
Jazayeri, M.: A simpler construction for showing the intrinsically exponential complexity of the circularity problem for attribute grammars. J. ACM 28, 715–720 (1981)
Jazayeri, M., Walter, K.G.: Alternating semantic evaluator. Proc. ACM 1975 Annual Conference, 230–234 (1975)
Kastens, U.: Ordered attribute grammars. Acta Inf. 13, 229–256 (1980)
Kennedey, K., Warren, S.K.: Automatic generation of efficient evaluators for attribute grammars. Proc. Third ACM Symp. Principles Programm. Lang., pp. 32–49 (1976)
Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theory 2, 127–145 (1968)
Knuth, D.E.: Semantics of context-free languages: Correction. Math. Syst. Theory 5, 95–96 (1971)
Möncke, U., Weisgerber, B., Wilhelm, R.: How to implement a system for manipulation of attributed trees. In: Informatik Fachberichte, Vol. 77, pp. 112–127. Berlin-Heidelberg-New York-Tokyo: Springer 1984
Möncke, U., Wilhelm, R.: Iterative algorithms on grammar graphs. In: Proc 8th Conference on Graphtheoretic Concepts in Computer Science, pp. 177–194. München-Wien: Hanser 1982
Nestor, J.R., Mishra, B., Scherlis, W.L., Wulf, W.A.: Extensions to attribute grammars. Technical Report TL 83-36, Tartan Laboratories Incorporated, 1983
Räihä, K.-J., Saarinen, M.: Testing attribute grammars for circularity. Acta Inf. 17, 185–192 (1982)
Reps, T.: Optimal-time incremental semantic analysis for syntax directed editors. Proc. Ninth ACM Symp. Principles Programm. Lang. pp. 169–176 (1982)
Reps, T., Teitelbaum, T., Demers, A.: Incremental context-dependent analysis for language based editors. ACM Trans. Programm. Lang. 5, 449–477 (1983)
Wilhelm, R.: Computation and use of data flow information in optimizing compilers. Acta Inf. 12, 209–225 (1979)
Yeh, D.: On incremental evaluation of ordered attribute grammars. BIT 23, 308–320 (1983)
Author information
Authors and Affiliations
Additional information
Part of this work was done while the author was visiting Tartan Laboratories Inc., Pittsburgh, PA, USA
Rights and permissions
About this article
Cite this article
Alblas, H. One-pass transformations of attributed program trees. Acta Informatica 24, 299–352 (1987). https://doi.org/10.1007/BF00265992
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00265992