Attributed tree transformations with delayed and smart re-evaluation

  • Henk Alblas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 371)


Transformations of attributed program trees form an essential part of compiler optimizations. A tree transformation may invalidate attribute instances, not only in the restructured part of the tree but also elsewhere in the tree. To make the attribution of the tree correct again a re-evaluator has to be activated.

Criteria are formulated which allow a delay in calling the re-evaluator. These criteria allow a strategy of repeatedly applying alternate attribute evaluation and tree transformation phases. An attribute evaluation phase consists of a tree walk in which all attribute instances receive their correct values. A tree transformation phase consists of a tree walk in which as many tree transformations are performed as possible. The transformation phase is never interrupted to carry out a re-evaluation.

For re-evaluation purposes an incremental simple multi-pass evaluator is presented, which works optimally in the number of recomputations and in the number of visits to subtrees during each pass.


Pass Number Attribute Evaluation Derivation Tree Evaluation Rule Attribute Instance 
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.


  1. 1.
    Alblas, H.: A characterization of attribute evaluation in passes. Acta Informatica 16, 427–464 (1981).Google Scholar
  2. 2.
    Alblas, H.: Incremental simple multi-pass attribute evaluation. Proc. NGI-SION 1986 Symposium (1986), pp. 319–342.Google Scholar
  3. 3.
    Alblas, H.: Optimal incremental simple multi-pass attribute evaluation. Memorandum INF 86-27, University of Twente (1986).Google Scholar
  4. 4.
    Alblas, H.: Iteration of transformation passes over attributed program trees. Memorandum INF 87-28, University of Twente (1987).Google Scholar
  5. 5.
    Alblas, H.: Attribute evaluation methods. Memorandum, University of Twente, to appear (1988).Google Scholar
  6. 6.
    DeRemer, F.L.: Transformational grammars. In: Compiler Construction: An advanced course, F.L. Bauer, J. Eickel (eds.). Lecture Notes in Computer Science, Vol. 21, Springer 1974, pp. 121–145.Google Scholar
  7. 7.
    Engelfriet, J.: Attribute grammars: Attribute evaluation methods. In: Methods and tools for compiler construction. Cambridge University Press 1984, pp. 103–138.Google Scholar
  8. 8.
    Engelfriet, J., Filè, G.: Simple multi-visit attribute grammars, JCSS 24, 283–314 (1982).Google Scholar
  9. 9.
    Ganzinger, H. and Giegerich, R.: A truly generative semantics directed compiler generator. In: Proc. SIGPLAN 1982 Symposium on Compiler Construction, SIGPLAN Notices 17, 6 (1982), pp. 172–184.Google Scholar
  10. 10.
    Giegerich, R., Möncke, U., Wilhelm, R.: Invariance of approximative semantics with respect to program transformations. Informatik-Fachberichte 50, Springer 1981, pp. 1–10.Google Scholar
  11. 11.
    Glasner, I., Möncke, U., Wilhelm, R.: OPTRAN, a language for the specification of program transformations. Informatik-Fachberichte 34, Springer 1980, pp. 125–142.Google Scholar
  12. 12.
    Kastens, U.: Ordered attribute grammars. Acta Informatica 13, 229–256 (1980).Google Scholar
  13. 13.
    Knuth, D.E.: Semantics of context-free languages. Math. Systems Theory 2, 127–145 (1968). Correction in: Math. Systems Theory 5, 95–96 (1971).Google Scholar
  14. 14.
    Möncke, U., Weisgerber, B., Wilhelm, R.: How to implement a system for manipulation of attributed trees. Informatik-Fachberichte 77, Springer 1984, pp. 112–127.Google Scholar
  15. 15.
    Nestor, J.R., Mishra, B., Scherlis, W.L., Wulf, W.A.: Extensions to attribute grammars. Technical Report TL 83-36, Tartan Laboratories Inc., 1983.Google Scholar
  16. 16.
    Reps, T., Teitelbaum, T., Demers, A.: Incremental context-dependent analysis for language based editors. ACM TOPLAS 5, 449–477 (1983).Google Scholar
  17. 17.
    Wilhelm, R.: Computation and use of data flow information in optimizing compilers. Acta Informatica 12, 209–225 (1979).Google Scholar
  18. 18.
    Yeh, D.: On incremental evaluation of ordered attribute grammars, BIT 23, 308–320 (1983).Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Henk Alblas
    • 1
  1. 1.Department of Computer ScienceUniversity of TwenteEnschedeThe Netherlands

Personalised recommendations