Skip to main content

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 3838))

Abstract

We explore the connection between term rewriting systems (TRS) and aspect-oriented programming (AOP). Term rewriting is a paradigm that is used in fields such as program transformation and theorem proving. AOP is a method for decomposing software, complementary to the usual separation into programs, classes, functions, etc. An aspect represents code that is scattered across the components of an otherwise orderly decomposed system. Using AOP, such code can be modularized into aspects and then automatically weaved into a system.

Aspect weavers are available for only a handful of languages. Term rewriting can offer a method for the rapid prototyping of weavers for more languages. We explore this claim by presenting a simple weaver implemented as a TRS.

We also observe that TRS can benefit from AOP. For example, their flexibility can be enhanced by factoring out hardwired code for tracing and logging rewrite rules. We explore methods for enhancing TRS with aspects and present one application: automatically connecting an interactive debugger to a language specification.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Aßmann, U., Ludwig, A.: Aspect weaving with graph rewriting. In: Czarnecki, K., Eisenecker, U.W. (eds.) GCSE 1999. Aßmann, U., Ludwig, A, vol. 1799, pp. 24–36. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  2. Baeten, J.C.M., Bergstra, J.A., Klop, J.W., Weijland, W.P.: Term rewriting systems with rule priorities. Theoretical Computer Science 67, 283–301 (1989)

    Article  MATH  MathSciNet  Google Scholar 

  3. Baxter, I., Pidgeon, C., Mehlich, M.: DMS: program transformation and practical scalable software evolution. In: International Conference on Software Engineering (May 2004)

    Google Scholar 

  4. Bergstra, J.A., Klop, J.W.: Conditional rewrite rules: confluence and termination. Journal of Computer and Systems Sciences 32, 323–362 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  5. Bethke, I., Klop, J.W., de Vrijer, R.: Descendants and origins in term rewriting. Information and Computation 159, 59–124 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  6. Borovansky, P., Kirchner, C., Kirchner, H., Moreau, P., Ringeissen, C.: An overview of ELAN. In: Kirchner, C., Kirchner, H. (eds.) Second Intl. Workshop on Rewriting Logic and its Applications. Electronic Notes in Theoretical Computer Science, vol. 15 (1998)

    Google Scholar 

  7. van den Brand, M.G.J., Deursen, A.v., Heering, J., de Jong, H.A., de Jonge, M., Kuipers, T., Klint, P., Moonen, L., Olivier, P.A., Scheerder, J., Vinju, J.J., Visser, E., Visser, J.: The ASF+SDF Meta-Environment: a Component-Based Language Development Environment. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, pp. 365–370. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  8. Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Quesada, J.F.: Maude: Specification and programming in rewriting logic. Theoretical Computer Science (2001)

    Google Scholar 

  9. van Deursen, A., Klint, P., Tip, F.: Origin tracking. Journal of Symbolic Computation 15, 523–545 (1993)

    Article  MATH  Google Scholar 

  10. Eker, S.M.: Associative-commutative matching with bipartite graph matching. Computer Journal 38(5), 381–399 (1995)

    Article  Google Scholar 

  11. Filman, R., Friedman, D.: Aspect-Oriented Programming is quantification and obliviousness. In: Workshop on Advanced Separation of Concerns at OOPSLA (2000)

    Google Scholar 

  12. Fradet, P., Südholt, M.: AOP: towards a generic framework using program transformation and analysis. In: Demeyer, S., Bosch, J. (eds.) ECOOP 1998 Workshops. LNCS, vol. 1543, pp. 394–397. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  13. Gray, J., Roychoudhury, S.: A technique for constructing aspect weavers using a program transformation engine. In: Proceedings of the 3rd international conference on Aspect-oriented software development, Lancaster, UK, pp. 36–45. ACM Press, New York (2004)

    Chapter  Google Scholar 

  14. Heering, J., Klint, P.: Semantics of programming languages: A tool-oriented approach. ACM Sigplan Notices 35(3), 39–48 (2000)

    Article  Google Scholar 

  15. Hirschfeld, R.: AspectS – aspect-oriented programming with Squeak. In: Aksit, M., Mezini, M., Unland, R. (eds.) NODe 2002. LNCS, vol. 2591, pp. 216–232. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  16. Huet, G., Kahn, G., Paulin-Mohring, C.: The Coq Proof Assistant - A tutorial - Version 8.0 (April 2004), http://coq.inria.fr

  17. Kalleberg, K.T., Visser, E.: Combining aspect-oriented and strategic programming. In: Cirstea, H., Marti-Oliet, N. (eds.) Workshop on Rule-Based Programming (RULE 2005), Nara, Japan, April 2005. Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers, Amsterdam (2005)

    Google Scholar 

  18. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  19. Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J., Irwin, J.: Aspect-oriented programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  20. Kim, H.: AspectC#: An AOSD implementation for C#. Master’s thesis, Trinity College (November 2002)

    Google Scholar 

  21. Kirchner, H., Moreau, P.-E.: Promoting Rewriting to a Programming Language: A Compiler for Non-Deterministic Rewrite Programs in Associative-Commutative Theories. Journal of Functional Programming (JFP) 11(2), 207–251 (2001)

    MATH  MathSciNet  Google Scholar 

  22. Klint, P.: A meta-environment for generating programming environments. ACM Transactions on Software Engineering and Methodology 2(2), 176–201 (1993)

    Article  Google Scholar 

  23. Lämmel, R.: Declarative aspect-oriented programming. In: Danvy, O. (ed.) Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), San Antonio, Texas, January 1999. BRICS Notes Series, vol. NS-99-1, pp. 131–146 (1999)

    Google Scholar 

  24. Lämmel, R., De Schutter, K.: What does aspect-oriented programming mean to Cobol?. In: Proceedings of Aspect-Oriented Software Development, March 2005, p. 12. ACM Press, New York (2005)

    Google Scholar 

  25. Nguyen, Q.-H., Kirchner, C., Kirchner, H.: External rewriting for skeptical proof assistants, vol. 29(3–4), pp. 309–336. Kluwer Academic Publishers, Dordrecht (2002)

    Google Scholar 

  26. Olivier, P.A.: A Framework for Debugging Heterogeneous Applications. PhD thesis, Universiteit van Amsterdam (2000)

    Google Scholar 

  27. Parr, T.J., Quong, R.W.: ANTLR: A predicated-LL(k) parser generator. Software – Practice & Experience 7(25), 789–810 (1995)

    Article  Google Scholar 

  28. Spinczyk, O., Gal, A., Schröder-Preikschat, W.: AspectC++: An aspect-oriented extension to C++. In: Proceedings of the 40th International Conference on Technology of Object-Oriented Languages and Systems (February 2002)

    Google Scholar 

  29. Terese: Term Rewriting Systems. Cambridge Tracts in Theoretical Computer Science, vol. 55. Cambridge University Press, Cambridge (2003)

    Google Scholar 

  30. van den Brand, M.G.J., Klint, P., Vinju, J.J.: Term rewriting with traversal functions. ACM Trans. Softw. Eng. Methodol. 12(2), 152–190 (2003)

    Article  Google Scholar 

  31. Van Wyk, E.: Aspects as modular language extensions. In: Proc. of Language Descriptions, Tools and Applications (LDTA). Electronic Notes in Theoretical Computer Science, vol. 82.3. Elsevier Science, Amsterdam (2003)

    Google Scholar 

  32. Visser, E.: Program transformation with Stratego/XT. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  33. Wu, H., Gray, J., Roychoudhury, S., Mernik, M.: Weaving a debugging aspect into domain-specific language grammars. In: ACM Symposium for Applied Computing (SAC) – Programming for Separation of Concerns Track, Santa Fe NM (March 2005)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Klint, P., van der Storm, T., Vinju, J. (2005). Term Rewriting Meets Aspect-Oriented Programming. In: Middeldorp, A., van Oostrom, V., van Raamsdonk, F., de Vrijer, R. (eds) Processes, Terms and Cycles: Steps on the Road to Infinity. Lecture Notes in Computer Science, vol 3838. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11601548_8

Download citation

  • DOI: https://doi.org/10.1007/11601548_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-30911-6

  • Online ISBN: 978-3-540-32425-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics