FSTComposer is a tool for composing software components based on their representation as feature structure trees (FSTs) and FST-based superimposition. FSTComposer implements the AHEAD model for software composition and program synthesis in a language-independent way. General information about FSTs and FST-based superimposition can be found in a conference paper (SC'08) and in two technical reports (MIP-0706) and (MIP-0712) of Department of Informatics and Mathematics of the University of Passau.
Currently, FSTComposer provides a Java parser and an XML parser that generate FSTs on the basis of source code. The result of a composition is a superimposed FST that can be displayed in several ways or written out as a composed program. The composition is handeled independently of a particular language. FSTComposer provides information about the input components and the composed program in several representations (XML, FST, algebraic expression, GUI). The examples section contains some code snippets taken from features written in Java and XML.
After downloading and unzipping the archive, FSTComposer is ready to use. The command below invokes FSTComposer in the directory in which it was installed:
--expression <expression file>
specifies the location of a file that lists the names of the components to compose. Note that the components are represented by file system directories that have the same name (a.k.a. containment hierarchies).
Several further command line options specify what FSTComposer is going to do with the input components:
--help
: This option prints some information about the options to the standard output.--base-directory <component search path>
: This option specifies where the components are located (if not in the same directory than the expression file). Note that the path has to end with a slash (examples/GraphJava/
instead of examples/GraphJava
)
--ahead
: This option is necessary to parse Jak/AHEAD source code (as opposed to Java source code).--write
: This option writes the composed program to a directory that is in the component source directory and whose name is the name of the input expression file.
--gui
: This option displays the input components in a GUI. When the option --resolve-references
is used, the dependencies between features/components are visualized.--xml
: This option prints the structure of the input components as XML string to the standard output.--fst
: This option prints the FST representation of the composed program to the standard output.--sum
: This option prints the FST representation of the composed program as a sum of algebraic terms to the standard output.--resolve-references
: This option analyzes several kinds of dependencies between the input features/components. The references appear in the XML output and the GUI.The below picture shows a screenshot of FSTComposer in GUI mode visualizing the interactions between the features/components of the GPL example.
A modification is an additional/alternative mechanism to implement features. It is a tree walk consisting of a query that specifies which nodes of a target FST are modified and a definition of change that specifies how selected nodes are changed. Details about modifications can be found in a technical report.
Modifications are expressed as special XML files with the extension .mod
. FSTComposer automatically recongnizes modifications that are located in a feature's directory and applies them to the program. For example, the below modification injects a field count
into the class Stack
:
Note that the feature and package names contain regular expressions. The reason is that every class Stack
is supposed to be modified regardless in which feature and package it is located. Further examples are a modification for counting the accesses to Vertex
objects and a modification for logging the state of Node
objects. The former is intended for the GPL case study and the latter for the Violet case study; both studies are included in the FSTComposer distribution. See also the StackJava example in the FSTComposer distribution (Version 0.2) for an example in action.
Beside the binaries, the archive contains six examples (GraphJak, GraphJava, GPL, GUIDSL, myVioletJava, StackJava). Every example contains at least one .expression
file that lists the components that are analyzed and/or composed. All examples are written in Jak, except GraphJava. Note that for all examples written in Jak the command line option --ahead
has to be specified.
For example, in order to compose the GraphJak example invoke:
Note that some examples (myVioletJava, StackJava, GPL) contain non-code artifacts such as XML documents. These documents are also composed via superimposition.
The source code of FSTComposer can be requested from the developers per mail.
FSTComposer was developed at the University of Passau, Germany. For information about the FSTComposer project,
please contact the development team via .
The FSTComposer project members: