JastAdd2 was developed at Lund University by Torbjörn Ekman, Görel Hedin, and Eva Magnusson. JastAdd2 has recieved additional contributions from Emma Söderberg, Jesper Öqvist and Niklas Fors.
For additional contributors, see the change logs.
Copyright (c) 2005-2013, The JastAdd Team. All rights reserved.
JastAdd2 is covered by the modified BSD License. For the full license text see the LICENSE file.
The latest version of JastAdd2 can be found at jastadd.org.
JastAdd2 requires a Java Runtime Environment (JRE) to run, and a JDK to build. The minimum required Java version for JastAdd2 is Java SE 6.
JastAdd2 uses JavaCC, JJTree, and Apache Ant. JavaCC and JJTree are included in the source tree of JastAdd2, so the only external tools needed are Java and Ant. See licenses/ for the full license text for JavaCC (and JJTree).
The context-free grammar used in JastAdd is based on an example from JavaCC.
The README file for the binary distribution (README-binary-dist.md) is written in the language Markdown. This file is then converted to HTML during the release process with the tool Markdown.pl (see licenses/ for license text).
Builds are done by using the Apache Ant script build.xml:
Ordinary build (generate and compile):
Create a new jar file (jastadd2.jar)
> ant jar
Make a new release (builds jar file, source- and binary zip files):
> ant release
Delete generated files
> ant clean
Bootstrap jastadd2 (replace the jastadd2.jar used to build jastadd2). For stability, bootstrap is done seldom and only with extra testing.
> ant bootstrap
.astJastAdd abstract syntax tree files
.jragJastAdd semantics files. Usually declarative.
.jaddJastAdd semantics files. Usually imperative.
.javaRegular Java sources
.jjtJavaCC files, using the JJTree AST-building commands.
src/javaJava source files
JastAdd.javaThe main class. Compiles the .ast and .jrag files to Java files.
JastAdd.jragExtends the top AST node (Grammar) with methods for adding .ast and .jrag info.
CommandLineArguments.javaA general class for reading in args and options from the command line.
JastAddTask.javaImplements an ANT task for running jastadd, including support for various args and options.
src/jastadd/JastAdd aspect and AST specifications
src/res/Templates, property files and other resources that are included in the JastAdd jar file.
src/gen/Generated source files
docDocumentation html files.
reference-manual.htmlThe reference manual
release-notes.htmlThe release nodes
index.htmlFor download from the web
*.phpHelper files for browsing uploaded files on the web
tools3rd party jar files used to build build JastAdd
LICENSEText file with the jastadd LICENSE.
release.shA script printing the commands for doing a release.
ChangeLogA textfile recording changes done to JastAdd, intended for users of JastAdd (focusing on external behavior).
ChangeLogUntil2010.txtA textfile containing cvs log messages until 2010 when the system was moved to svn.
Understanding the Implementation
Overall behavior when running JastAdd:
- First, options are read and global flags are set.
- Then, an incomplete AST is built by parsing the .ast file.
- Then, the .jrag files are parsed, and their information is weaved into the AST.
- Now, the AST is complete, and attributes can be accessed.
- Then, possible errors are printed.
- Then, target AST classes are generated.
JavaCC and its tree-building extension, JJTree, are used for parsing. They assume top classes called Node and SimpleNode. Normally, JJTree generates its own AST node subclasses, but we "fool" it to use the AST classes generated by JastAdd instead (by generating them before we run JavaCC/JJTree).
However, we let JJTree generate the AST classes for the Java code used inside equations in .jrag files. This is because these expressions are not analyzed by JastAdd. They are just unparsed at appropriate places in the generated Java code.