Advertisement

A Systematic Approach to Abstract Interpretation of Program Transformations

  • Sven KeidelEmail author
  • Sebastian Erdweg
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11990)

Abstract

Abstract interpretation is a technique to define sound static analyses. While abstract interpretation is generally well-understood, the analysis of program transformations has not seen much attention. The main challenge in developing an abstract interpreter for program transformations is designing good abstractions that capture relevant information about the generated code. However, a complete abstract interpreter must handle many other aspects of the transformation language, such as backtracking and generic traversals, as well as analysis-specific concerns, such as interprocedurality and fixpoints. This deflects attention.

We propose a systematic approach to design and implement abstract interpreters for program transformations that isolates the abstraction for generated code from other analysis aspects. Using our approach, analysis developers can focus on the design of abstractions for generated code, while the rest of the analysis definition can be reused. We show that our approach is feasible and useful by developing three novel inter-procedural analyses for the Stratego transformation language: a singleton analysis for constant propagation, a sort analysis for type checking, and a locally-illsorted sort analysis that can additionally validate type changing generic traversals.

Notes

Acknowledgements

This research was supported by DFG grant “Evolute”. We thank André Pacak and Tamás Szabó who provided helpful feedback on the introduction.

References

  1. 1.
    Al-Sibahi, A.S., Jensen, T.P., Dimovski, A.S., Wasowski, A.: Verification of high-level transformations with inductive refinement types. CoRR (2018)Google Scholar
  2. 2.
    Balland, E., Brauner, P., Kopetz, R., Moreau, P.-E., Reilles, A.: Tom: piggybacking rewriting on Java. In: Baader, F. (ed.) RTA 2007. LNCS, vol. 4533, pp. 36–47. Springer, Heidelberg (2007).  https://doi.org/10.1007/978-3-540-73449-9_5CrossRefGoogle Scholar
  3. 3.
    Callahan, D., Cooper, K.D., Kennedy, K., Torczon, L.: Interprocedural constant propagation. In: Proceedings of the 1986 SIGPLAN Symposium on Compiler Construction, Palo Alto, California, USA, 25–27 June 1986, pp. 152–161 (1986)Google Scholar
  4. 4.
    Chen, Y.-F.R., Gansner, E.R., Koutsofios, E.: A C++ data model supporting reachability analysis and dead code detection. In: Jazayeri, M., Schauer, H. (eds.) ESEC/SIGSOFT FSE-1997. LNCS, vol. 1301, pp. 414–431. Springer, Heidelberg (1997).  https://doi.org/10.1007/3-540-63531-9_28CrossRefGoogle Scholar
  5. 5.
    Clavel, M., et al.: Maude: specification and programming in rewriting logic. Theor. Comput. Sci. 285(2), 187–243 (2002)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Conference Record of the Fourth ACM Symposium on Principles of Programming Languages, Los Angeles, California, USA, January 1977, pp. 238–252 (1977)Google Scholar
  7. 7.
    Cousot, P., Cousot, R.: Comparing the Galois connection and widening/narrowing approaches to abstract interpretation. In: Bruynooghe, M., Wirsing, M. (eds.) PLILP 1992. LNCS, vol. 631, pp. 269–295. Springer, Heidelberg (1992).  https://doi.org/10.1007/3-540-55844-6_142CrossRefzbMATHGoogle Scholar
  8. 8.
    Cousot, P., Cousot, R.: Formal language, grammar and set-constraint-based program analysis by abstract interpretation. In: Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture, FPCA 1995, La Jolla, California, USA, 25–28 June 1995, pp. 170–181 (1995)Google Scholar
  9. 9.
    Erdweg, S., Rendel, T., Kästner, C., Ostermann, K.: SugarJ: library-based syntactic language extensibility. In: Proceedings of the 26th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2011, part of SPLASH 2011, Portland, OR, USA, 22–27 October 2011, pp. 391–406 (2011)Google Scholar
  10. 10.
    Erdweg, S., Vergu, V., Mezini, M., Visser, E.: Modular specification and dynamic enforcement of syntactic language constraints. In: Proceedings of International Conference on Modularity (AOSD), pp. 241–252. ACM (2014)Google Scholar
  11. 11.
    Hughes, J.: Generalising monads to arrows. Sci. Comput. Program. 37(1–3), 67–111 (2000)MathSciNetCrossRefGoogle Scholar
  12. 12.
    Keidel, S., Erdweg, S.: Compositional soundness proofs of abstract interpreters. PACMPL 3(OOPSLA), 176:1–176:28 (2019). https://dblp.uni-trier.de/rec/bibtex/journals/pacmpl/KeidelE19
  13. 13.
    Keidel, S., Poulsen, C.B., Erdweg, S.: Compositional soundness proofs of abstract interpreters. PACMPL 2(ICFP), 72:1–72:26 (2018)Google Scholar
  14. 14.
    Klint, P., van der Storm, T., Vinju, J.J.: RASCAL: a domain specific language for source code analysis and manipulation. In: Ninth IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2009, Edmonton, Alberta, Canada, 20–21 September 2009, pp. 168–177 (2009)Google Scholar
  15. 15.
    Lämmel, R.: Typed generic traversal with term rewriting strategies. Log. Algebr. Program. 54(1–2), 1–64 (2003)MathSciNetzbMATHGoogle Scholar
  16. 16.
    Leroy, X., et al.: The CompCert C verified compiler. Documentation and user’s manual. INRIA Paris-Rocquencourt 53 (2012)Google Scholar
  17. 17.
    Matthews, J., Findler, R.B., Flatt, M., Felleisen, M.: A visual environment for developing context-sensitive term rewriting systems. In: van Oostrom, V. (ed.) RTA 2004. LNCS, vol. 3091, pp. 301–311. Springer, Heidelberg (2004).  https://doi.org/10.1007/978-3-540-25979-4_21CrossRefGoogle Scholar
  18. 18.
    Paterson, R.: A new notation for arrows. In: Proceedings of the Sixth ACM SIGPLAN International Conference on Functional Programming (ICFP 2001), Firenze, Florence, Italy, 3–5 September 2001, pp. 229–240 (2001)Google Scholar
  19. 19.
    Jones, S.P., Lämmel, R.: Scrap your boilerplate. In: Ohori, A. (ed.) APLAS 2003. LNCS, vol. 2895, pp. 357–357. Springer, Heidelberg (2003).  https://doi.org/10.1007/978-3-540-40018-9_23CrossRefGoogle Scholar
  20. 20.
    Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  21. 21.
    Sălcianu, A., Rinard, M.: Purity and side effect analysis for Java programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 199–215. Springer, Heidelberg (2005).  https://doi.org/10.1007/978-3-540-30579-8_14CrossRefGoogle Scholar
  22. 22.
    Sewell, P., et al.: Ott: effective tool support for the working semanticist. Funct. Program. 20(1), 71–122 (2010)CrossRefGoogle Scholar
  23. 23.
    Visser, E., Benaissa, Z.: A core language for rewriting. Electr. Notes Theor. Comput. Sci. 15, 422–441 (1998)CrossRefGoogle Scholar
  24. 24.
    Visser, E., Benaissa, Z., Tolmach, A.P.: Building program optimizers with rewriting strategies. In: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (ICFP 1998), Baltimore, Maryland, USA, 27–29 September 1998, pp. 13–26 (1998)Google Scholar
  25. 25.
    Xie, Y., Chou, A., Engler, D.R.: ARCHER: using symbolic, path-sensitive analysis to detect memory access errors. In: Proceedings of the 11th ACM SIGSOFT Symposium on Foundations of Software Engineering 2003 held jointly with 9th European Software Engineering Conference, ESEC/FSE 2003, Helsinki, Finland, 1–5 September 2003, pp. 327–336 (2003)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.JGU MainzMainzGermany

Personalised recommendations