Abstract
Data-flow transformations used in optimizing compilers are also useful in other programming tools such as code generators, aspect weavers, domain-specific optimizers, and refactoring tools. These applications require source-to-source transformations rather than transformations on a low-level intermediate representation. In this paper we describe the composition of source-to-source data-flow transformations in the program transformation language Stratego. The language supports the high-level specification of transformations by means of rewriting strategy combinators that allow a natural modeling of data- and control-flow without committing to a specific source language. Data-flow facts are propagated using dynamic rewriting rules. In particular, we introduce the concept of dependent dynamic rewrite rules for modeling the dependencies of data-flow facts on program entities such as variables. The approach supports the combination of analysis and transformation, the combination of multiple transformations, the combination with other types of transformations, and the correct treatment of variable binding constructs and lexical scope to avoid free variable capture.
Keywords
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.
Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
References
Aho, A., Sethi, R., Ullman, J.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)
Appel, A.: Modern compiler implementation in ML. Cambridge University Press, Cambridge (1998)
Assmann, U.: How To Uniformly Specify Program Analysis and Transformation. In: Gyimóthy, T. (ed.) CC 1996. LNCS, vol. 1060, pp. 121–135. Springer, Heidelberg (1996)
Bravenboer, M., van Dam, A., Olmos, K., Visser, E.: Program transformation with scoped dynamic rewrite rules. Technical Report UU-CS-2005-005, Institute of Information and Computing Sciences, Utrecht University (2005)
Click, C., Cooper, K.D.: Combining analyses, combining optimizations. ACM Transactions on Programming Languages and Systems 17(2), 181–196 (1995)
Drape, S., de Moor, O., Sittampalam, G.: Transforming the .NET intermediate language using path logic programming. In: Kirchner, C. (ed.) Proceedings of the Fourth ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2002), Pittsburgh, Pensylvania, USA, October 2002, pp. 133–144. ACM, New York (2002)
Lacey, D., de Moor, O.: Imperative program transformation by rewriting. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, pp. 52–68. Springer, Heidelberg (2001)
Lerner, S., Grove, D., Chambers, C.: Combining dataflow analyses and transformations. In: SIGPLAN Symposium on Principles of Programming Languages (POPL 2002), Portland, Oregon, January 2002, pp. 270–282 (2002)
Lerner, S., Millstein, T., Chambers, C.: Automatically proving the correctness of compiler optimizations. In: Programming Language Design and Implementation (PLDI 2003), ACM SIGPLAN, June 2003, pp. 220–231 (2003)
Lerner, S., Millstein, T., Rice, E., Chambers, C.: Automated soundness proofs for dataflow analyses and transformations via local rules. In: Principles of Programming Languages (POPL 2005), ACM SIGPLAN, January 2005, pp. 364–377 (2005)
Martin, F.: PAG an efficient program analyzer generator. International Journal on Software Tools for Technology Transfer STTT 2(1), 46–67 (1998)
Muchnick, S.: Advanced compiler design and implementation. Morgan Kaufmann, San Francisco (1997)
Olmos, K., Visser, E.: Strategies for source-to-source constant propagation. In: Gramlich, B., Lucas, S. (eds.) Workshop on Reduction Strategies (WRS 2002), Copenhagen, Denmark, July 2002. ENTCS, vol. 70, p. 20. Elsevier, Amsterdam (2002)
Olmos, K., Visser, E.: Composing source-to-source data-flow transformations with rewriting strategies and dependent dynamic rewrite rules. Technical Report UU-CS-2005-006, Institute of Information and Computing Sciences, Utrecht University (2005)
Sittampalam, G., de Moor, O., Larsen, K.F.: Incremental execution of transformation specifications. In: SIGPLAN Symposium on Principles of Programming Languages (POPL 2004), pp. 26–38. ACM, New York (2004)
Tjiang, S.W.K., Hennessy, J.L.: Sharlit—A tool for building optimizers. In: ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation (July 1992)
Visser, E.: Scoped dynamic rewrite rules. In: van den Brand, M., Verma, R. (eds.) Rule Based Programming (RULE 2001). ENTCS, vol. 59/4. Elsevier Science Publishers, Amsterdam (2001)
Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 299–315. Springer, Heidelberg (2002)
Visser, E.: Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)
Visser, E., Benaissa, Z.-e.-A., Tolmach, A.: Building program optimizers with rewriting strategies. In: Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP 1998), pp. 13–26. ACM Press, New York (1998)
Wegman, M., Zadeck, F.: Constant propagation with conditional branches. ACM Transactions on Programming Languages and Systems 13, 181–210 (1991)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Olmos, K., Visser, E. (2005). Composing Source-to-Source Data-Flow Transformations with Rewriting Strategies and Dependent Dynamic Rewrite Rules. In: Bodik, R. (eds) Compiler Construction. CC 2005. Lecture Notes in Computer Science, vol 3443. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-31985-6_14
Download citation
DOI: https://doi.org/10.1007/978-3-540-31985-6_14
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-25411-9
Online ISBN: 978-3-540-31985-6
eBook Packages: Computer ScienceComputer Science (R0)