While source transformation systems and languages like DMS, Stratego, ASF + SDF, Rascal and TXL provide a general, powerful base from which to attack a wide range of analysis, transformation and migration problems in the hands of an expert, new users often find it difficult to see how these tools can be applied to their particular kind of problem. The difficulty is not that these very general systems are ill-suited to the solution of the problems, it is that the paradigms for solving them using combinations of the system’s language features are not obvious.

In this paper we attempt to approach this difficulty for the TXL language in a non-traditional way - by introducing the paradigms of use for each kind of problem directly. Rather than simply introducing TXL’s language features, we present them in context as they are required in the paradigms for solving particular classes of problems such as parsing, restructuring, optimization, static analysis and interpretation. In essence this paper presents the beginnings of a “TXL Cookbook” of recipes for effectively using TXL, and to some extent other similar tools, in a range of common source processing and analysis problems. We begin with a short introduction to TXL concepts, then dive right in to some specific problems in parsing, restructuring and static analysis.


source transformation source analysis TXL coding paradigms 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Barnard, D.T., Holt, R.C.: Hierarchic Syntax Error Repair for LR Grammars. Int. J. Computing and Info. Sci. 11(4), 231–258 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Baxter, I., Pidgeon, P., Mehlich, M.: DMS: Program Transformations for Practical Scalable Software Evolution. In: Proc. Int. Conf. on Software Engineering, pp. 625–634. ACM Press, New York (2004)CrossRefGoogle Scholar
  3. 3.
    Bergstra, J.A., Heering, J., Klint, P.: Algebraic Specification. ACM Press, New York (1989)zbMATHGoogle Scholar
  4. 4.
    Beyer, D.: Relational programming with CrocoPat. In: Proc. Int. Conf. on Software Engineering, pp. 807–810. ACM Press, New York (2006)Google Scholar
  5. 5.
    van den Brand, M., Klint, P., Vinju, J.J.: Term Rewriting with Traversal Functions. ACM Trans. on Software Eng. and Meth. 12(2), 152–190 (2003)CrossRefzbMATHGoogle Scholar
  6. 6.
    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
  7. 7.
    Cordy, J.R., Dean, T.R., Malton, A.J., Schneider, K.A.: Source Transformation in Software Engineering using the TXL Transformation System. J. Info. and Software Tech. 44(13), 827–837 (2002)CrossRefGoogle Scholar
  8. 8.
    Cordy, J.R.: The TXL Source Transformation Language. Sci. Comput. Program. 61(3), 190–210 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Cordy, J.R.: Source Transformation, Analysis and Generation in TXL. In: Proc. ACM SIGPLAN Works. on Partial Eval. and Program Manip., pp. 1–11. ACM Press, New York (2006)Google Scholar
  10. 10.
    Cordy, J.R.: The TXL Programming Language, Version 10.5. Queen’s University at Kingston, Canada (2007),
  11. 11.
    Cordy, J.R., Visser, E.: Tiny Imperative Language,
  12. 12.
  13. 13.
    Dean, T.R., Cordy, J.R., Malton, A.J., Schneider, K.A.: Agile Parsing in TXL. J. Automated Softw. Eng. 10(4), 311–336 (2003)CrossRefGoogle Scholar
  14. 14.
    van Deursen, A., Kuipers, T.: Building Documentation Generators. In: Proc. 1999 Int. Conf. on Software Maint., pp. 40–49. IEEE Press, Los Alamitos (1999)Google Scholar
  15. 15.
    Guo, X., Cordy, J.R., Dean, T.R.: Unique Renaming of Java Using Source Transformation. In: Proc. IEEE Int. Works. on Source Code Analysis and Manip., pp. 151–160. IEEE Press, Los Alamitos (2003)Google Scholar
  16. 16.
    Holt, R.C.: An introduction to TA: The Tuple-Attribute Language. Technical report, University of Toronto (1997),
  17. 17.
    Holt, R.C.: Structural Manipulations of Software Architecture using Tarski Relational Algebra. In: Proc. Int. Working Conf. on Reverse Eng., pp. 210–219. IEEE Press, Los Alamitos (1998)Google Scholar
  18. 18.
    Kamiya, T., Kusumoto, S., Inoue, K.: CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code. IEEE Trans. Software Eng. 28(7), 654–670 (2002)CrossRefGoogle Scholar
  19. 19.
    Moonen, L.: Generating Robust Parsers using Island Grammars. In: Proc. Int. Working Conf. on Reverse Eng., pp. 13–22. IEEE Press, Los Alamitos (2001)CrossRefGoogle Scholar
  20. 20.
    Vinju, J., Klint, P., van der Storm, T.: Rascal: a Domain Specific Language for Source Code Analysis and Manipulation. In: Proc. Int. Working Conf. on Source Code Analysis and Manip., pp. 168–177. IEEE Press, Los Alamitos (2009)Google Scholar
  21. 21.
    Martin, J.: RSF file format. Technical report, University of Victoria (August 1999),
  22. 22.
    Weiser, M.D.: Program slices: Formal, Psychological, and Practical Investigations of an Automatic Program Abstraction Method. University of Michigan, Ann Arbor (1979)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • James R. Cordy
    • 1
  1. 1.School of ComputingQueen’s UniversityKingstonCanada

Personalised recommendations