skip to main content
research-article

Domain-specific languages and program generation with meta-AspectJ

Published:12 November 2008Publication History
Skip Abstract Section

Abstract

Meta-AspectJ (MAJ) is a language for generating AspectJ programs using code templates. MAJ itself is an extension of Java, so users can interleave arbitrary Java code with AspectJ code templates. MAJ is a structured metaprogramming tool: a well-typed generator implies a syntactically correct generated program. MAJ promotes a methodology that combines aspect-oriented and generative programming. A valuable application is in implementing small domain-specific language extensions as generators using unobtrusive annotations for syntax extension and AspectJ as a back-end. The advantages of this approach are twofold. First, the generator integrates into an existing software application much as a regular API or library, instead of as a language extension. Second, a mature language implementation is easy to achieve with little effort since AspectJ takes care of the low-level issues of interfacing with the base Java language.

In addition to its practical value, MAJ offers valuable insights to metaprogramming tool designers. It is a mature metaprogramming tool for AspectJ (and, by extension, Java): a lot of emphasis has been placed on context-sensitive parsing and error reporting. As a result, MAJ minimizes the number of metaprogramming (quote/unquote) operators and uses type inference to reduce the need to remember type names for syntactic entities.

References

  1. Bachrach, J. and Playford, K. 2001. The Java syntactic extender (JSE). In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA). ACM Press, New York, NY, 31--42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Baker, J. and Hsieh, W. C. 2002. Maya: multiple-dispatch syntax extension in Java. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). ACM Press, New York, NY, 270--281. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Batory, D., Lofaso, B., and Smaragdakis, Y. 1998. JTS: Tools for implementing domain-specific languages. In Proceedings of the IEEE International Conference on Software Reuse (ICSR) (Victoria, B.C., Canada). 143--153. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Batory, D., Sarvela, J. N., and Rauschmayer, A. 2003. Scaling step-wise refinement. In Proceedings of the IEEE International Conference on Software Engineering (ICSE). IEEE Computer Society Press, Los Alamitos, CA, 187--197. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Bracha, G. and Cook, W. 1990. Mixin-based inheritance. In Proceedings of the European Conference on Object-Oriented Programming and Object-Oriented Programming Systems, Languages, and Applications (OOPSLA/ECOOP). ACM Press, New York, NY, 303--311. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Bravenboer, M., Vermaas, R., Vinju, J., and Visser, E. 2005. Generalized type-based disambiguation of meta programs with concrete object syntax. In Generative Programming and Component Engineering (GPCE) Conference, R. Glück and M. Lowry, Eds. Lecture Notes in Computer Science, vol. 3676. Springer, Berlin, Germany, 157--172. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Brichau, J., Mens, K., and Volder, K. D. 2002. Building composable aspect-specific languages. In Generative Programming and Component Engineering (GPCE) Conference. Lecture Notes in Computer Science, vol. 2487. Springer, Berlin, Germany. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Bryant, A., Catton, A., De Volder, K., and Murphy, G. C. 2002. Explicit programming. In Proceedings of the Conference on Aspect-Oriented Software Development (AOSD). ACM Press, New York, NY, 10--18. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Calcagno, C., Taha, W., Huang, L., and Leroy, X. 2003. Implementing multistage languages using ASTs, gensym, and reflection. In Generative Programming and Component Engineering (GPCE) Conference. Lecture Notes in Computer Science, vol. 2830. Springer, Berlin, Germany, 57--76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Chiba, S. 1995. A metaobject protocol for C++. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA). SIGPLAN Not. 30, 10, 285--299. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Chiba, S. and Nishizawa, M. 2003. An easy-to-use toolkit for efficient Java bytecode translators. In Generative Programming and Component Engineering (GPCE) Conference. Springer-Verlag, New York, NY, 364--376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Clinger, W. 1991. Macros that work. In Proceedings of the Conference on Principles of Programming Languages (POPL). ACM Press, New York, NY, 155--162. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Cordy, J. R., Halpern-Hamu, C. D., and Promislow, E. 1991. TXL: A rapid prototyping system for programming language dialects. Comput. Lang. 16, 1, 97--107. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ducasse, S., Nierstrasz, O., Schärli, N., Wuyts, R., and Black, A. P. 2006. Traits: A mechanism for fine-grained reuse. ACM Trans. Program. Lang. Syst. 28, 2, 331--388. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Gosling, J., Joy, B., Steele, G., and Bracha, G. 2005. The Java Language Specification, 3rd ed. Addison-Wesley, Boston, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Guy L. Steele, J. 1990. Common LISP: The language, 2nd ed. Digital Press, Newton, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Huang, S. S. and Smaragdakis, Y. 2006. Easy language extension with Meta-AspectJ. In Proceedings of the International Conference on Software Engineering, Emerging Results. 865--868. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Huang, S. S., Zook, D., and Smaragdakis, Y. 2005. Statically safe program generation with SafeGen. In Proceedings of the Generative Programming and Component Engineering Conference. 309--326. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., and Griswold, W. 2001. Getting started with AspectJ. Commun. ACM 44, 10, 59--65. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Kohlbecker, E., Friedman, D. P., Felleisen, M., and Duba, B. 1986. Hygienic macro expansion. In Proceedings of the 1986 ACM Conference on LISP and Functional Programming. ACM Press, New York, NY, 151--161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Lohmann, D., Blaschke, G., and Spinczyk, O. 2004. Generic advice: On the combination of AOP with generative programming in AspectC++. In Generative Programming and Component Engineering (GPCE) Conference, G. Karsai and E. Visser, Eds. Lecture Notes in Computer Science, vol. 3286. Springer Verlag, Berlin, Germany, 55--74.Google ScholarGoogle Scholar
  22. Mohnen, M. 2002. Interfaces with default implementations in Java. In Principles and Practice of Programming. National University of Ireland, Maynooth, County Kildare, Ireland, Ireland, 35--40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Parr, T. J. and Quong, R. W. 1995. ANTLR: A predicated LL(k) parser generator. Softw.-Pract. Exp. 25, 7 (July), 789--810. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Rajan, H. and Sullivan, K. 2003. Eos: Instance-level aspects for integrated system design. SIGSOFT Softw. Eng. Notes 28, 5, 297--306. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Sheard, T. and Jones, S. P. 2002. Template metaprogramming for Haskell. In Proceedings of the ACM SIGPLAN Workshop on Haskell. ACM Press, New York, NY, 1--16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Shonle, M., Lieberherr, K., and Shah, A. 2003. Xaspects: An extensible system for domain specific aspect languages. In Proceedings of OOPSLA'2003, Domain-Driven Development Track. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Smaragdakis, Y. 2004. A personal outlook on generator research. In Domain-Specific Program Generation, C. Lengauer, D. Batory, C. Consel, and M. Odersky, Eds. Lecture Notes in Computer Science, vol. 3016, Springer-Verlag, Berlin, Germany.Google ScholarGoogle Scholar
  28. Smaragdakis, Y. and Batory, D. 1999. Scoping constructs for program generators. In Proceedings of the Generative and Component-Based Software Engineering Symposium (GCSE). Earlier version in Tech. rep. UTCS-TR-96-37, University of Texas at Austin, Austin, TX. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Soares, S., Laureano, E., and Borba, P. 2002. Implementing distribution and persistence aspects with AspectJ. In Proceedings of the Conferences on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA). ACM Press, New York, NY, 174--190. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Taha, W. and Sheard, T. 1997. Multi-stage programming with explicit annotations. In Proceedings of the Conference on Partial Evaluation and Semantics-Based Program Manipulation (Amsterdam, The Netherlands, June). ACM Press, New York, NY, 203--217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Tilevich, E., Urbanski, S., Smaragdakis, Y., and Fleury, M. 2003. Aspectizing server-side distribution. In Proceedings of the Conference on Automated Software Engineering Conference. IEEE Computer Society Press, Los Alamitos, CA.Google ScholarGoogle Scholar
  32. Visser, E. 2002. Metaprogramming with concrete object syntax. In Generative Programming and Component Engineering (GPCE) Conference. Lecture Notes in Computer Science, vol. 2487. Springer, Berlin, Germany, 299--315. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Volder, K. D. 1998. Type-oriented logic meta programming. Ph.D. dissertation. Vrije Universiteit Brussel, Brussels, Belgium.Google ScholarGoogle Scholar
  34. Weise, D. and Crew, R. F. 1993. Programmable syntax macros. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). 156--165. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Zook, D., Huang, S. S., and Smaragdakis, Y. 2004. Generating AspectJ programs with meta-AspectJ. In Generative Programming and Component Engineering (GPCE) Conference. Springer-Verlag, Berlin, Germany, 1--18.Google ScholarGoogle Scholar

Index Terms

  1. Domain-specific languages and program generation with meta-AspectJ

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM Transactions on Software Engineering and Methodology
          ACM Transactions on Software Engineering and Methodology  Volume 18, Issue 2
          November 2008
          130 pages
          ISSN:1049-331X
          EISSN:1557-7392
          DOI:10.1145/1416563
          Issue’s Table of Contents

          Copyright © 2008 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 12 November 2008
          • Accepted: 1 October 2007
          • Revised: 1 April 2007
          • Received: 1 December 2005
          Published in tosem Volume 18, Issue 2

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article
          • Research
          • Refereed

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader