Declarative, formal, and extensible syntax definition for aspectJ
Open Access
- 16 October 2006
- journal article
- conference paper
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 41 (10) , 209-228
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.Keywords
This publication has 23 references indexed in Scilit:
- Right nulled GLR parsersACM Transactions on Programming Languages and Systems, 2006
- A Versatile Kernel for Multi-language AOP2005
- Generalized Type-Based Disambiguation of Meta Programs with Concrete Object SyntaxLecture Notes in Computer Science, 2005
- Elkhound: A Fast, Practical GLR Parser Generator2004
- Generating LR syntax error messages from examplesACM Transactions on Programming Languages and Systems, 2003
- Dataflow Pointcut in Aspect-Oriented Programming2003
- Disambiguation Filters for Scannerless Generalized LR ParsersLecture Notes in Computer Science, 2002
- Higher-order functions for parsingJournal of Functional Programming, 1992
- The syntax definition formalism SDF—reference manual—ACM SIGPLAN Notices, 1989
- Scannerless NSLR(1) parsing of programming languagesACM SIGPLAN Notices, 1989