AspectJ-front provides:
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
).
Possible applications of AspectJ-front include:
AspectJ-front defines three variations of the AspectJ language:
The main tool of aspectj-front, parse-aspectj
, supports these variations by the command-line options --abc
and --ajc
.
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.
You can browse the syntax definition of AspectJ (including Java) online:
Variations:
AspectJ-front has been used for the following research publications and dissertations (reverse chronological) :
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:
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
.
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.
We use yellowgrass.org to keep track of issues. Please report any issues that you encounter!
Please send questions to the users@strategoxt.org mailing list. Also, the AspectJ-front developers are usually available on IRC at irc.freenode.net/stratego. Feel free to drop by!
The sources are available from Subversion:
Questions:
Please report bugs to our issue tracking system:
Contributors:
Feedback and bug reports:
Sponsors:
AspectJ-front is LGPL (GNU Lesser General Public License) software.
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.
The SDF syntax definition for the aspect part of AspectJ is based on the technical report
This report defines the syntax of the AspectJ languages in more formal way, which does not seem available from the AspectJ project themselves.