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.
- AspectJ documentation. http://www.eclipse.org/aspectj/docs.php. With links to the AspectJ Programming Guide and the AspectJ 5Developer's Notebook.Google Scholar
- Proc. of the 5th Intl. Conference on Aspect-Oriented Software Development (AOSD 2006), Bonn, Germany, Mar. 2006. ACM Press.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- E. Bodden and V. Stolz. J-LO, the Java Logical Observer. http://www-i2.informatik.rwth-aachen.de/Research/RV/JLO/.Google Scholar
- G. Bracha and W. Cook. Mixin-based inheritance. In OOPSLA/ECOOP'90, pages 303--311. ACM Press, 1990. Google Scholar
Digital Library
- G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. GJ specification, May 1998.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Eclipse Java Development Tools (JDT) website. http://www.eclipse.org/jdt/.Google Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- G. Hutton. Higher-order functions for parsing. Journal of Functional Programming, (2(3)):323--343, July 1992.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- T. Parr. ANTLR Parser Generator. http://www.antlr.org.Google Scholar
- J. Rekers. Parser Generation for Interactive Environments. PhD thesis, University of Amsterdam, 1992.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- E. Scott and A. Johnstone. Right nulled GLR parsers. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(4):577--618, 2006. Google Scholar
Digital Library
- É. 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 Scholar
Digital Library
- É. Tanter and J. Noyé. A versatile kernel for multi-language AOP. In Glück and Lowry {18}, pages 173--188. Google Scholar
Digital Library
- M. Tomita. Efficient Parsing for Natural Languages. A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, 1985. Google Scholar
Digital Library
- E. Visser. Scannerless generalized-LR parsing. Technical Report P9707, Programming Research Group, University of Amsterdam, July 1997.Google Scholar
- E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, September 1997.Google Scholar
- 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 Scholar
Index Terms
Declarative, formal, and extensible syntax definition for aspectJ
Recommendations
Declarative, formal, and extensible syntax definition for aspectJ
Proceedings of the 2006 OOPSLA ConferenceAspect-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 ...
Pure and declarative syntax definition: paradise lost and regained
OOPSLA '10Syntax definitions are pervasive in modern software systems, and serve as the basis for language processing tools like parsers and compilers. Mainstream parser generators pose restrictions on syntax definitions that follow from their implementation ...
Pure and declarative syntax definition: paradise lost and regained
OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applicationsSyntax definitions are pervasive in modern software systems, and serve as the basis for language processing tools like parsers and compilers. Mainstream parser generators pose restrictions on syntax definitions that follow from their implementation ...







Comments