Walk Your Tree Any Way You Want

  • Anya Helene Bagge
  • Ralf Lämmel
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7909)

Abstract

Software transformations in the Nuthatch style are described as walks over trees (possibly graphs) that proceed in programmer-defined steps which may observe join points of the walk, may observe and affect state associated with the walk, may rewrite the walked tree, may contribute to a built tree, and must walk somewhere, typically along one branch or another. The approach blends well with OO programming. We have implemented the approach in the Nuthatch/J library for Java.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aho, A.V., Ullman, J.D.: Translations on a Context-Free Grammar. Information and Control 19(5), 439–475 (1971)MathSciNetCrossRefGoogle 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)CrossRefGoogle Scholar
  3. 3.
    Bravenboer, M., van Dam, A., Olmos, K., Visser, E.: Program Transformation with Scoped Dynamic Rewrite Rules. Fundamenta Informaticae 69(1-2), 123–178 (2006)MathSciNetMATHGoogle Scholar
  4. 4.
    Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/XT 0.17. A language and toolset for program transformation. Sci. Comput. Program. 72(1-2), 52–70 (2008)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Comon, H., Dauchet, M., Gilleron, R., Löding, C., Jacquemard, F., Lugiez, D., Tison, S., Tommasi, M.: Tree Automata Techniques and Applications (2007), http://www.grappa.univ-lille3.fr/tata (release October 12, 2007)
  6. 6.
    Cordy, J.R.: The TXL source transformation language. Sci. Comput. Program. 61(3), 190–210 (2006)MathSciNetMATHCrossRefGoogle Scholar
  7. 7.
    George, L., Wider, A., Scheidgen, M.: Type-Safe Model Transformation Languages as Internal DSLs in Scala. In: Hu, Z., de Lara, J. (eds.) ICMT 2012. LNCS, vol. 7307, pp. 160–175. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  8. 8.
    Huet, G.: The Zipper. J. Funct. Program. 7(5), 549–554 (1997)MathSciNetMATHCrossRefGoogle Scholar
  9. 9.
    Jouault, F., Allilaire, F., Bézivin, J., Kurtev, I.: ATL: A model transformation tool. Sci. Comput. Program. 72(1-2), 31–39 (2008)MATHCrossRefGoogle Scholar
  10. 10.
    Kalleberg, K.T., Visser, E.: Combining Aspect-Oriented and Strategic Programming. In: Workshop on Rule-Based Programming (RULE 2005). ENTCS, vol. 147, pp. 5–30 (2006)Google Scholar
  11. 11.
    Kalleberg, K.T., Visser, E.: Strategic Graph Rewriting: Transforming and Traversing Terms with References. In: 6th Intl. Workshop on Reduction Strategies in Rewriting and Programming (WRS 2006) (2006), online publicationGoogle Scholar
  12. 12.
    Kalleberg, K.T., Visser, E.: Fusing a Transformation Language with an Open Compiler. In: 7th Workshop on Language Descriptions, Tools and Applications (LDTA 2007). ENTCS, pp. 18–31. Elsevier (2007)Google Scholar
  13. 13.
    Klint, P., van der Storm, T., Vinju, J.J.: Rascal: A Domain Specific Language for Source Code Analysis and Manipulation. In: 9th IEEE Intl. Working Conf. on Source Code Analysis and Manipulation (SCAM 2009), pp. 168–177. IEEE CS (2009)Google Scholar
  14. 14.
    Lämmel, R.: The Sketch of a Polymorphic Symphony. In: Reduction Strategies in Rewriting and Programming (WRS 2002). ENTCS, vol. 70, pp. 135–155 (2002)Google Scholar
  15. 15.
    Lämmel, R., Peyton Jones, S.L.: Scrap your boilerplate: a practical design pattern for generic programming. In: ACM SIGPLAN Intl. Workshop on Types in Languages Design and Implementation (TLDI 2003), pp. 26–37. ACM (2003)Google Scholar
  16. 16.
    Lämmel, R., Thompson, S., Kaiser, M.: Programming errors in traversal programs over structured data. Sci. Comput. Program (2012) (in press), doi:10.1016/j.scico.2011.11.006Google Scholar
  17. 17.
    Lämmel, R., Visser, E., Visser, J.: Strategic programming meets adaptive programming. In: 2nd Intl. Conf. on Aspect-Oriented Software Development (AOSD 2003), pp. 168–177 (2003)Google Scholar
  18. 18.
    Lämmel, R., Visser, J.: A Strafunski Application Letter. In: Dahl, V. (ed.) PADL 2003. LNCS, vol. 2562, pp. 357–375. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  19. 19.
    Lieberherr, K.J., Patt-Shamir, B., Orleans, D.: Traversals of object structures: Specification and Efficient Implementation. ACM Transactions on Programming Languages and Systems 26(2), 370–412 (2004)CrossRefGoogle Scholar
  20. 20.
    Mens, T., Van Gorp, P.: A taxonomy of model transformation. ENTCS, vol. 152, pp. 125–142 (2006)Google Scholar
  21. 21.
    Moreau, P.E., Reilles, A.: Rules and Strategies in Java. In: Reduction Strategies in Rewriting and Programming (WRS 2007). ENTCS, vol. 204, pp. 71–82 (2008)Google Scholar
  22. 22.
    Palsberg, J., Jay, C.B.: The Essence of the Visitor Pattern. In: 22nd Intl. Computer Software and Applications Conf (COMPSAC 1998), pp. 9–15. IEEE Computer Society (1998)Google Scholar
  23. 23.
    Ren, D., Erwig, M.: A generic recursion toolbox for Haskell or: scrap your boilerplate systematically. In: Proceedings of the ACM SIGPLAN Workshop on Haskell, pp. 13–24. ACM (2006)Google Scholar
  24. 24.
    Reynolds, J.C.: The Discoveries of Continuations. Lisp and Symbolic Computation 6(3-4), 233–248 (1993)CrossRefGoogle Scholar
  25. 25.
    Sloane, A.M.: Lightweight Language Processing in Kiama. In: Fernandes, J.M., Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2009. LNCS, vol. 6491, pp. 408–425. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  26. 26.
    Tisi, M., Martínez, S., Jouault, F., Cabot, J.: Refining Models with Rule-based Model Transformations. Tech. Rep. 7582, INRIA (2011)Google Scholar
  27. 27.
    Veldhuizen, T.L.: Expression templates. C++ Report 7(5), 26–31 (1995), reprinted in C++ Gems, ed. Stanley LippmanGoogle Scholar
  28. 28.
    Viera, M., Swierstra, S.D., Lempsink, E.: Haskell, do you read me?: constructing and composing efficient top-down parsers at runtime. In: 1st ACM SIGPLAN Symposium on Haskell (Haskell 2008), pp. 63–74. ACM (2008)Google Scholar
  29. 29.
    Visser, E., Benaissa, Z., Tolmach, A.: Building program optimizers with rewriting strategies. In: 3rd ACM SIGPLAN Intl. Conf. on Functional Programming, ICFP 1998, pp. 13–26. ACM Press (1998)Google Scholar
  30. 30.
    Visser, J.: Visitor combination and traversal control. In: 16th ACM SIGPLAN Conf. on Object Oriented Programming, OOPSLA 2001, pp. 270–282. ACM (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Anya Helene Bagge
    • 1
  • Ralf Lämmel
    • 2
  1. 1.Bergen Language Design Laboratory, Dept. of InformaticsUniversity of BergenNorway
  2. 2.Software Languages TeamUniversity of Koblenz-LandauGermany

Personalised recommendations