Fundamentals of the Ekeko/X program transformation tool

Printer-friendly version
  • An interest in programming languages and program transformations

Ekeko/X is a template-based program search and transformation tool for Java. Its searches and transformations are specified in terms of code templates. In essense, a code template is a code snippet where parts can be replaced by wildcards or variables, or they can be annotated with various constraints. To give an example of a template group, consisting of two templates:

[....acceptVisitor(...)]@[(equals ?invocation)]

[public void acceptVisitor(ComponentVisitor v) ...]@[(invoked -by ?invocation)]

The first template will match with any calls to acceptVisitor methods, whereas the second will match with the corresponding method declaration. Ellipsis characters (...) indicate wildcards. In the first template, the method call is annotated with @[(equals ?invocation)]. By attaching this equals directive, any matching method call will be bound to the metavariable ?invocation. In the second template, the invokes directive is used to establish the relation between the method call (?invocation) and the method declaration.

Goal & Research Activities: 

In this thesis we would like to approach Ekeko/X from a more fundamental perspective, in two different ways:

First, the algorithm that currently performs template matches is currently restricted to traversing the template's structure (essentially a decorated AST) in a depth-first manner. To introduce additional expressivity, the notion of strategic programming can be applied to Ekeko/X.  Using strategic programming, it is possible to define different strategies to traverse data structures, and to switch between strategies at certain variation points.

Second, when creating a transformation, it can be helpful to automatically generate an inverse transformation as well. For example, when creating a transformation that transforms library calls using an older API into calls for a newer version, generating a transformation that can downgrade the newer API calls back to the old ones can be useful if e.g. bugs are found in the newer library. To realize the generation of such inverse transformations, the work concerning bidirectional transformations can be used as a starting point.