skip to main content
10.1145/1167473.1167491acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Declarative, formal, and extensible syntax definition for aspectJ

Published:16 October 2006Publication History

ABSTRACT

Aspect-Oriented Programming (AOP) is attracting attention from both research and industry, as illustrated by the ever-growing popularity of AspectJ, the de facto standard AOP extension of Java. From a compiler construction perspective AspectJ is interesting as it is a typical example of compositional language, ie a language composed of a number of separate languages with different syntactical styles: in addition to plain Java, AspectJ includes a language for defining pointcuts and one for defining advices. Language composition represents a non-trivial challenge for conventional parsing techniques. First, combining several languages with different lexical syntax leads to considerable complexity in the lexical states to processed. Second, as new language features for AOP are being explored, many research proposals are concerned with further extending the AspectJ language, resulting in a need for an extensible syntax definition.This paper shows how scannerless parsing elegantly addresses the issues encountered by conventional techniques when parsing AspectJ . We present the design of a modular, extensible, and formal definition of the lexical and context-free aspects of the AspectJ syntax in the Syntax Definition Formalism SDF, which is implemented by a scannerless, generalized-LR parser (SGLR). We introduce grammar mixins as a novel application of SDF's modularity features, which allows the declarative definition of different keyword policies and combination of extensions. We illustrate the modular extensibility of our definition with syntax extensions taken from current research on aspect languages. Finally, benchmarks show the reasonable performance of scannerless generalized-LR parsing for this grammar.

References

  1. AspectJ documentation. http://www.eclipse.org/aspectj/docs.php. With links to the AspectJ Programming Guide and the AspectJ 5Developer's Notebook.Google ScholarGoogle Scholar
  2. Proc. of the 5th Intl. Conference on Aspect-Oriented Software Development (AOSD 2006), Bonn, Germany, Mar. 2006. ACM Press.Google ScholarGoogle Scholar
  3. J. Aldrich. Open modules: Modular reasoning about advice. In Proc. of the European Conference on Object-Oriented Programming (ECOOP'05), volume 3586 of LNCS, pages 144--168. Springer-Verlag, July 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Allan, P. Avgustinov, A. S. Christensen, L. Hendren, S. Kuzins, O. Lhoták, O. de Moor, D. Sereni, G. Sittampalam, and J. Tibble. Adding trace matching with free variables to AspectJ. In Proc. of the 20th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2005), pages 345--364, San Diego, California, USA, Oct. 2005. ACM Press. ACM SIGPLAN Notices, 40(11). Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Avgustinov, A. S. Christensen, L. Hendren, S. Kuzins, J. Lhoták, O. Lhoták, O. de Moor, D. Sereni, G. Sittampalam, and J. Tibble. abc: an extensible AspectJ compiler. In Proc. of the 4th Intl. Conference on Aspect-Oriented Software Development (AOSD'04), pages 87--98, New York, NY, USA, 2005. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Avgustinov, E. Hajiyev, N. Ongkingco, O. de Moor, D. Sereni, J. Tibble, and M. Verbaere. Semantics of static pointcuts in AspectJ. Technical Report abc-2006-3, Programming Tools Group, Oxford University, Oxford, United Kingdom, 2006.Google ScholarGoogle Scholar
  7. J. Aycock and R. N. Horspool. Faster generalized lr parsing. In Proc. of 8th Intl. Conference on Compiler Construction (CC'99), volume 1575, pages 32--46, Amsterdam, March 1999. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Batory, B. Lofaso, and Y. Smaragdakis. JTS: tools for implementing domain-specific languages. In Proc. Fifth Intl. Conference on Software Reuse (ICSR'98), pages 143--153. IEEE Computer Society, June 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Begel and S. L. Graham. Language analysis and tools for input stream ambiguities. In Fourth Workshop on Language Descriptions, Tools and Applications (LDTA'04), Electronic Notes in Theoretical Computer Science, Barcelona, Spain, April 2004. Elsevier.Google ScholarGoogle Scholar
  10. D. Blasband. Parsing in a hostile world. In Proc. of the Eighth Working Conference on Reverse Engineering (WCRE'01), page 291, Washington, DC, USA, 2001. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Bodden and V. Stolz. J-LO, the Java Logical Observer. http://www-i2.informatik.rwth-aachen.de/Research/RV/JLO/.Google ScholarGoogle Scholar
  12. G. Bracha and W. Cook. Mixin-based inheritance. In OOPSLA/ECOOP'90, pages 303--311. ACM Press, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. GJ specification, May 1998.Google ScholarGoogle Scholar
  14. M. van den Brand, J. Scheerder, J. J. Vinju, and E.Visser. Disambiguation filters for scannerless generalized LR parsers. In N. Horspool, editor, Compiler Construction (CC'02), volume 2304 of LNCS, pages 143--158. Springer-Verlag, April 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Bravenboer, R. Vermaas, J. J. Vinju, and E. Visser. Generalized type-based disambiguation of meta programs with concrete object syntax. In Glück and Lowry {18}, pages 157--172. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Bravenboer and E. Visser. Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In D. C. Schmidt, editor, Proc. of the 19th ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA'04), pages 365--383. ACM Press, October 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Eclipse Java Development Tools (JDT) website. http://www.eclipse.org/jdt/.Google ScholarGoogle Scholar
  18. R. Glück and M. Lowry, editors. Proc. of the 4th ACM SIGPLAN/SIGSOFT Conference on Generative Programming and Component Engineering (GPCE 2005), volume 3676 of LNCS, Tallinn, Estonia, Sept./Oct. 2005. Springer-Verlag.Google ScholarGoogle Scholar
  19. B. Harbulot and J. Gurd. A join point for loops in AspectJ. In Proc. of the 5th Intl. Conference on Aspect-Oriented Software Development (AOSD 2006) {2}. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. Heering, P. R. H. Hendriks, P. Klint, and J. Rekers. The syntax definition formalism SDF - reference manual. SIGPLAN Notices, 24(11):43--75, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. L. Hendren, O. de Moor, A. S. Christensen, and the abc team. The abc scanner and parser, including an LALR(1) grammar for AspectJ. Techrep, Programming Tools Group, Oxford University and the Sable research group, McGill University, September 2004.Google ScholarGoogle Scholar
  22. G. Hutton. Higher-order functions for parsing. Journal of Functional Programming, (2(3)):323--343, July 1992.Google ScholarGoogle Scholar
  23. C. L. Jeffery. Generating LR syntax error messages from examples. ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5):631--640, September 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In J. Lindskov Knudsen, editor, ECOOP 2001: Object-Oriented Programming: 15th European Conference, volume 2072 of LNCS, pages 327--353. Springer-Verlag, June 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. M. M. Lehman. On understanding laws, evolution, and conservation in the large-program life cycle. Journal of Systems and Software, 1(3):213--231, 1980.Google ScholarGoogle Scholar
  26. H. Masuhara and K. Kawauchi. Dataflow pointcut in aspect-oriented programming. In Proc. of the First Asian Symposium on Programming Languages and Systems (APLAS'03), volume 2895 of LNCS, pages 105--121. Springer-Verlag, Nov. 2003.Google ScholarGoogle ScholarCross RefCross Ref
  27. S. McPeak and G. C. Necula. Elkhound: A fast, practical GLR parser generator. In E. Duesterwald, editor, Proc. of 13th Intl. Conference on Compiler Construction (CC'04), volume 2985 of LNCS, pages 73--88, Berlin, April 2004. Springer-Verlag.Google ScholarGoogle Scholar
  28. N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for Java. In Proc. of the 12th Intl. Conference on Compiler Construction, volume 2622 of LNCS, pages 138--152. Springer-Verlag, April 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. N. Ongkingco, P. Avgustinov, J. Tibble, L. Hendren, O. de Moor, and G. Sittampalam. Adding open modules to AspectJ. In Proc. of the 5th Intl. Conference on Aspect-Oriented Software Development (AOSD 2006) {2}. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. T. Parr. ANTLR Parser Generator. http://www.antlr.org.Google ScholarGoogle Scholar
  31. J. Rekers. Parser Generation for Interactive Environments. PhD thesis, University of Amsterdam, 1992.Google ScholarGoogle Scholar
  32. K. Sakurai, H. Masuhara, N. Ubayashi, S. Matsuura, and S. Komiya. Association aspects. In K. Lieberherr, editor, Proc. of the 3rd Intl. Conference on Aspect-Oriented Software Development (AOSD 2004), pages 16--25, Lancaster, UK, Mar. 2004. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. D. J. Salomon and G. V. Cormack. Scannerless NSLR(1) parsing of programming languages. ACM SIGPLAN Notices, 24(7):170--178, 1989. Proc. of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (PLDI'89). Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. D. J. Salomon and G. V. Cormack. The disambiguation and scannerless parsing of complete character-level grammars for programming languages. Technical Report 95/06, Department of Computer Science, University of Manitoba, Winnipeg, Canada, 1995.Google ScholarGoogle Scholar
  35. E. Scott and A. Johnstone. Right nulled GLR parsers. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(4):577--618, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. É. Tanter, K. Gybels, M. Denker, and A. Bergel. Context-aware aspects. In Proc. of the 5th Intl. Symposium on Software Composition (SC 2006), LNCS, pages 227--249, Vienna, Austria, Mar. 2006. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. É. Tanter and J. Noyé. A versatile kernel for multi-language AOP. In Glück and Lowry {18}, pages 173--188. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. M. Tomita. Efficient Parsing for Natural Languages. A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, July 1997.Google ScholarGoogle Scholar
  40. E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.Google ScholarGoogle Scholar
  41. D. Zook, S. S. Huang, and Y. Smaragdakis. Generating AspectJ programs with Meta-AspectJ. In G. Karsai and E. Visser, editors, Generative Programming and Component Engineering (GPCE'04), volume 3286 of LNCS, pages 1--19. Springer, October 2004.Google ScholarGoogle Scholar

Index Terms

  1. Declarative, formal, and extensible syntax definition for 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

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!