JunGL: a Scripting Language for Refactoring

Mathieu Verbaere, Ran Ettinger, and Oege de Moor

Abstract

Refactorings are behaviour-preserving program transformations, typically for improving the structure of existing code. A few of these transformations have been mechanised in interactive development environments. Many more refactorings have been proposed, and it would be desirable for programmers to script their own refactorings. Implementing such source-to-source transformations, however, is quite complex: even the most sophisticated development environments contain significant bugs in their refactoring tools.We present a domain-specific language for refactoring, named JunGL. It manipulates a graph representation of the program: all information about the program, including ASTs for its compilation units, variable binding, control flow and so on is represented in a uniform graph format. The language is a hybrid of a functional language (in the style of ML) and a logic query language (akin to Datalog). JunGL furthermore has a notion of demand-driven evaluation for constructing computed information in the graph, such as control flow edges. Borrowing from earlier work on the specification of compiler optimisations, JunGL uses so-called `path queries' to express dataflow properties.We motivate the design of JunGL via a number of non-trivial refactorings, and describe its implementation on the.NET platform.

Details

Publication typeInproceedings
Published inICSE '06: Proceedings of the 28th International Conference on Software Engineering
URLhttp://doi.acm.org/10.1145/1134285.1134311
Pages172–181
ISBN1-59593-375-1
AddressNew York, NY, USA
PublisherACM Press
> Publications > JunGL: a Scripting Language for Refactoring