Dryad - The Tree Nymph
Stratego -- Strategies for Program Transformation
Dryad is a natural
female tree spirit, associated with trees. Also, it is a collection of tools for developing transformation systems for Java source and bytecode.
Overview of Features
Dryad Bytecode Interface
Dryad implements a conversion from the class file format to ATerm and vice versa.
class2aterm
is a disassembler for Java bytecode. It produces an ATerm representation of
a Java
.class
file.
class2aterm
can be used to obtain just the types of the members of a class, or
it can be used to decompile the full .class file (i.e. including code). Pass the
-c
option to disassemble code.
aterm2class
is an assembler for Java bytecode. It accepts an ATerm representation of a
.class
file and constructs a real
.class
file from that.
The format of the bytecode representation in ATerms is defined in a tree grammar:
ClassTree.rtg.
Dryad Front: Disambiguation and Type-Checking
dryad-front
is a composition of some compiler components in the front-end of the Dryad compiler. Currently, its main component is the qualification and reclassification of names. This is an essential component for any tool that needs to analyse or transform Java code.
After parsing a Java source files, the tree contains many ambiguous constructs. For example, the parser on its own cannot determine whether the identifier
System
in
System.out.println("Hello world!")
refers to a package, class, field or local variable. Similarly,
out
might be a package, a class, an inner classes of the
System
, a field of the class
System
and so on. Dryad-front resolves these ambiguities by analyzing the sources and reading the bytecode of the classes that are used. It returns a fully disambiguated abstract syntax tree.
dryad-front
also provides a type checker for Java, which annotates all expressions with their type. This type checker is still under development, but you can already use it by passing
--tc on
to
dryad-front
.
Dryad Library for Stratego
Dryad also provides a large library of functions useful for developing Java transformation systems in Stratego. All of the components of Dryad are based on this library. The main feature of the library is a unified representation of Java bytecode and source code classes in the
Dryad Model. Classes can be loaded from the Dryad Repository and a
java.lang.reflect
like API provides access to members, types, superclasses, etc.
Documentation
Download
Distributions are build continuously:
We advice to use
Nix for installing Dryad. Nix provides one-click installation of Dryad and all its dependencies. Nix will make it very easy to stay up-to-date with the latest developments without any installation and configuration problems.
Dependencies
Installation from a source tarball requires the following packages:
- Latest Stratego/XT
- JavaFront, latest pre-release
- JDK 5.0 (Dryad uses 5.0 language features)
The
configure
script does not require any explicit configuration. Dryad will try to find the JDK by searching the path for
javac
. Stratego/XT and Java-front will be found by
pkg-config
.
If you build Dryad from Subversion, then there are some additional dependencies:
- BCEL 5.1 (
--with-bcel
)
- jakarta-regexp 1.3 (
--with-regexp
)
- ATerm Library for Java
- aterm-java 1.6 (
--with-aterm-java
)
- jjtraveler 0.4.3 (
--with-jjtraveler
)
- shared-objects 1.4 (
--with-shared-objects
)
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 Dryad developers are usually available on IRC at
irc.freenode.net/stratego. Feel free to drop by!
Source Repository
The sources of Dryad are available from Subversion.
Team
Committers:
Committers emeritus:
Feedback and bug reports:
- Eelco Visser - design feedback
- Gerrit van den Geest - bug reports for bytecode interface
- Huib van den Brink - bug reports for bytecode interface
- Valentin David - bug reports for disambiguation and type checking
Sponsors:
License
Dryad is
LGPL (GNU Lesser General Public License) software. This means that you can use the Dryad Library (and tools) without being required to distribute your software under the GPL.
Related Software
- Java-front is a package for generation or transformation of Java code, and forms the foundation of Dryad.
- The Dryad Compiler uses Dryad to compile a mixed language of Java and bytecode to Java class files.