To run the Java Aspect Metamodel Interpreter (JAMI) you will need Eclipse and the AspectJ Development Toolkit (AJDT). If you have already installed these, you can skip ahead to Obtaining JAMI
- Eclipse is available here. Currently we use version 3.2.1, as version 3.2.2 is not supported (yet) by the AJDT. See the download site for Eclipse 3.2.1
- The AJDT can be installed using the builtin update/install function within eclipse:
-
- Within Eclipse, select Help -> Software updates > Find and Install.
- Select "Search for new features to install". Add a "New remote Site..". Name: "AJDT update site", URL: http://download.eclipse.org/tools/ajdt/32/update
- Only include the "AJDT update site" you just added in the list of sites to include in search for new software. Press "Finish". From the search results, install "Eclipse AspectJ Development Tools 1.4.1.200611230655" (not the one below, which is version 1.4.0).
- Accept license agreement, click next etc. until installation finishes (this will take a while!), then restart eclipse.
- You can check whether the AJDT is succesfully installed by looking at Help->About, which should now include some info on the AJDT version etc.
There are two methods of obtaining the JAMI source code: from a "release" zipfile, which is basically just a complete eclipse workspace, or using Subversion.
Downloading releases
Releases can be downloaded here. Unzip the release file, start eclipse, and select the workspace which is the location of the directory you just unzipped (you can switch workspaces through File -> Switch Workspace). Then, use File -> Import to import all projects into this workspace. If necessary, change the target platform to Java 5.0 (if this is not yet the default in your eclipse installation). Each example project contains (at least) one main class, which can be run directly from Eclipse.
Downloading using Subversion
Using Eclipse, it is quite easy to import the project from Sourceforge SVN:
- You will need to install the Subclipse plugin for Eclipse to obtain Subversion support.
- Start Eclipse and open an empty/new workspace (if you have selected a default workspace, you can switch using File -> Switch Workspace).
- Select menu Window -> Open Perspective -> Other -> SVN Repository Exploring
- Right-click in the SVN Repositories pane (on the left, by default), choose New -> Repository Location
- The repository URL is https://jami.svn.sourceforge.net/svnroot/jami/. When a password is requested (usually on checkout/checkin), use your Sourceforge username/password.
- Browse the repository, selecting projects "aspectinterpreter", "minimal" and "testminimal". Right-click -> Checkout.
- Switch back to the Java view/perspective. Project 'aspectinterpreter' contains the metamodel and its interpreter, project 'minimal' is a minimal example aspect language, and 'testminimal' contains a sample program (written in 'minimal') which you can compile and run to test whether everything works.
We use the Antlr parser generator to implement parsers for our prototype languages. A minimal language example (MinimAL - a Minimal Aspect Language) is included with JAMI. Of course you can use other means of parsing your programs (as long as you can eventually map their AST to metamodel objects).
Tips when using Antlr
Antlr consists of two parts: a tool to convert lexer/grammar specifications to Java source code (that implements the actual lexer/parser), and a library which the generated Java parser code will reuse, containing e.g. definitions of the default AST class. Both parts are included in a JAR-file (antlr-2.7.7.jar) which is already included in the MinimAL project (which is included in the JAMI workspace). If you start your own language implementation project using Antlr, you need to add this library (jar file) through the Project properties - Java Build Path - Library tab.
To run Antlr on a grammar specification file (e.g. minimal.g), you can add an external tool to Eclipse:
- Go to Run - External tools - External tools.
- Create a new "program" entry (*not* an Ant Build entry), name it "Antlr compiler".
- Location: /path/to/java-executable (e.g. c:\program files\java\jdk_1.5\bin\java),
Working directory: "${container_loc}”
Arguments: -classpath “${workspace_loc}/minimal/antlr-2.7.7.jar” antlr.Tool “${resource_loc}"
- On the “refresh” tab, specify “refresh resources...in the folder containing the selected resource”, such that Eclipse will remember to rebuild the (re)generated Java files each time you run Antlr (!!)
- Make sure the grammar file is "active" (has focus) in Eclipse when you run the tool (because we just specified the tool to run on the currently active file).
Alternatively, you could create an Ant buildfile.