Introduction
AspectJ-front provides:
- Modular syntax definition for AspectJ 5.0 in SDF. The AspectJ syntax definition is an extension of the modular syntax definition of Java provided by Java-front.
- Hand-crafted pretty-printer for AspectJ. The pretty-printer is an extension of the pretty-printer for the Java in Java-front.
AspectJ-front can be used to parse AspectJ programs and pretty-print the abstract syntax tree back to an AspectJ source file. The parse result is in the ATerm format (which can be converted to XML using
aterm2xml
).
Applications
Possible applications of AspectJ-front include:
- One of the killer features of the syntax definition is its extensibility. Therefore, one of the applications of AspectJ-front could be the prototyping of AspectJ extensions by a syntactic extension of the AspectJ syntax, followed by a desugaring (possibly implemented in Stratego) to plain AspectJ.
- AspectJ-front could be used in the front-end of an AspectJ compiler.
- AspectJ-front can be used for the generation of AspectJ programs using concrete AspectJ syntax (similar to Meta-AspectJ and JavaJava).
- AspectJ-front can be used to analyse AspectJ programs syntactically. If you need more semantic information, then you need to do more work or use an existing AspectJ compiler.
Variations
AspectJ-front defines three variations of the AspectJ language:
- AJF, which is the most liberal definition, where only real ambiguities are resolved, for example by reserving keywords at very specific locations.
- ABC, which reserves keywords in a context-sensitive way, thus defining the language supported by the abc compiler for AspectJ.
The main tool of aspectj-front,
parse-aspectj
, supports these variations by the command-line options
--abc
and
--ajc
.
Quality and Testing
Unit Testing. AspectJ-front has a testsuite based on parse-unit, a unit-testing tool for SDF. This testsuite mostly tests problematic syntax that we have encountered while working on the AspectJ syntax definition. In the testsuite, the results of the parses are checked by comparing the resulting AST to an expected AST pattern.
Roundtrip Testing. AspectJ-front is not a complete compiler, so we cannot just apply the existing testsuites for AspectJ. Instead, we run roundtrip tests for all the valid source files in the available testsuites. By roundtrip testing we refer to the full cycle of a parse, followed by a pretty-print, followed by a second parse, followed by a diff of the first and the second parse. Roundtrip testing is useful for finding problems in the parser as well as the pretty-printer.
AJC. The
AJC variant of the AspectJ syntax is continuously tested in our buildfarm by a roundtrip test of all the valid AspectJ source files in the ajc testsuite 1.5.0 (
download checkout). The
latest test reports (warning: big file) are available and show all the abstract syntax trees and the pretty-printed source files. There are a few minor issues that have not solved because it is unclear if the syntax used in the test files should be supported at all. The issues are
discussed later at this webpage.
ABC. The
ABC variant has not yet been tested using the full abc testsuite: we have only applied selected sources. We are working on a full report of AspectJ-front applied to the abc testsuite.
See also the notes on quality and compliance for the
Java syntax definition on which AspectJ-front is based.
Documentation
You can browse the syntax definition of AspectJ (including Java) online:
Variations:
Publications
AspectJ-front has been used for the following research publications (reverse chronological) :
- Pavel Avgustinov, Elnar Hajiyev, Neil Ongkingco, Oege de Moor, Damien Sereni, Julian Tibble, Mathieu Verbaere. Semantics of static pointcuts in AspectJ. In Proceedings of the SIGPLAN-SIGACT Symposium on Principles of Programming Language (POPL), Nice, France, January 2007. ( webpage )
- Martin Bravenboer, Éric Tanter, and Eelco Visser. Declarative, Formal, and Extensible Syntax Definition for AspectJ - A Case for Scannerless Generalized-LR Parsing. In Proceedings of the 21st ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2006), Portland, USA, October 2006. (pdf)
- Eric Tanter. An Extensible Kernel Language for AOP. In Proceedings of the AOSD Workshop on Open and Dynamic Aspect Languages (ODAL 2006). March 2006, Bonn, Germany.
- Martin Bravenboer, Rob Vermaas, Jurgen Vinju and Eelco Visser. Generalized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax. In Proceedings of the Fourth International Conference on Generative Programming and Component Engineering (GPCE 2005), Tallinn, Estonia, September 2005. (pdf, presentation)
Download
Latest Release
Distributions (source tarball, RPM, source RPM, binary for Microsoft Windows) are created continuously:
AspectJ-front contains a subpackage
aspectj-front-syntax
which just provides the syntax definition and parsetables (not the command-line tools and the pretty-printer). This subpackage has no dependencies at all. The latest release is available at:
Installation
AspectJ-front requires
aterm
,
sdf2-bundle
,
strategoxt
, and
java-front
, which are available from the release page of AspectJ-front. If necessary (e.g. for MinGW compilation) you can replace
strategoxt
with
stratego-libraries
and leave out the
sdf2-bundle
.
Install AspectJ-front and its dependencies with the usual sequence of commands:
$ ./configure
$ make
$ make install
You might need to set your
PKG_CONFIG_PATH
if you did not install the dependencies in a standard location. Configure will tell you to do this if it cannot find aterm, java-front, stratego-libraries, or strategoxt.
On Cygwin and MinGW you need to increase the default stack size, or the resulting tools will immediately produce a segmentation fault. You an do this by setting
CFLAGS
to
-O2 -Wl,--stack=0x2300000
.
Subversion Checkout
The distributions contain the latest of the latest developments, but if you really want to, the latest sources can be checked out using:
svn checkout https://svn.strategoxt.org/repos/StrategoXT/aspectj-front/trunk
Before you can configure the package as described above you have to run the
./bootstrap
script.
Project Info
Issue Tracking
We use JIRA to keep track of issues. Please report any issues that you encounter!
Contact and Mailing List
Please send questions to the
stratego@cs.uu.nl mailing list. Also, the AspectJ-front developers are usually available on IRC at
irc.freenode.net/stratego. Feel free to drop by!
Source Repository
The sources are available from Subversion:
Feedback
Questions:
Please report bugs to our JIRA issue tracking system:
Team
Contributors:
Feedback and bug reports:
Sponsors:
License
AspectJ-front is
LGPL (GNU Lesser General Public License) software.
Testsuite Issues
AJC
The AJC roundtrip testsuite reports a few failures that we have deliberately not resolved.
-
new/IntroducedFieldInc.java
. For this file the final diff fails. However, there is a not a difference between the two files. The problem is that the AspectJ-front pretty-printer inserts parentheses only where necessary. The original file has unnecessary parentheses, which gives the parser slightly more information about the use of an identifier: (i).count
is guaranteed to be a field access, where i.count requires semantic analysis to find out if i
is a typename.
-
pureJava/test120/Driver.java
. This file uses a unicode escape outside of a string literal, which we do not support. The JLS requires unicode escapes to be processed before parsing (i.e. lexically). However, lexical preprocessing is inherently incompatible with composing languages, which is one of our main businesses. Therefore, we have not implemented such a preprocessor, though you can easily apply one if you want to (for example, the ANTLR grammar for Java comes with such a preprocessing tool).
-
bugs150/AnnotationPlusPatternParseError.aj
. This file uses the pointcut call(* (@MemberOfMonitoredSet *)+.*(..))
. In the previous version of AspectJ, and according to the AspectJ 5 notebook, this is not allowed: subtype patterns are only allowed for names, not for type patterns. We will try to find out if this should be supported, and if so, change the syntax definition.
-
src/java5/annotations/aspectMembers/a/AnnotatedAspect08.aj
. This is an invalid source file that is not allowed by the ajc
compiler itself. Currently it is unclear to us why this file is in the testsuite at all.
-
src/java5/generics/pointcuts/GenericDeclaringTypeWithParameterErasure.aj
. This file uses a parameterized execution pointcut, which is not allowed by ajc
either.
Acknowledgements
The
SDF syntax definition for the aspect part of AspectJ is based on the technical report
- "The abc scanner and parser, including an LALR(1) grammar for AspectJ" by Laurie Hendren, Oege de Moor, Aske Simon Christensen and the abc team. (AspectBench Compiler for AspectJ).
This report defines the syntax of the AspectJ languages in more formal way, which does not seem available from the AspectJ project themselves.