Scripting a refactoring with Rascal and Eclipse

M. Hills, P. Klint, J.J. Vinju

Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

16 Citations (Scopus)
2 Downloads (Pure)

Abstract

To facilitate experimentation with creating new, complex refactorings, we want to reuse existing transformation and analysis code as orchestrated parts of a larger refactoring: i.e., to script refactorings. The language we use to perform this scripting must be able to deal with the diversity of languages, tools, analyses, and transformations that arise in practice. To illustrate one solution to this problem, in this paper we describe, in detail, a specific refactoring script for switching from the Visitor design pattern to the Interpreter design pattern. This script, written in the meta-programming language Rascal, and targeting an interpreter written in Java, extracts facts from the interpreter code using the Eclipse JDT, performs the needed analysis in Rascal, and then transforms the interpreter code using a combination of Rascal code and existing JDT refactorings. Using this script we illustrate how a new, real and complex refactoring can be scripted in a few hundred lines of code and within a short timeframe. We believe the key to successfully building such refactorings is the ability to pair existing tools, focused on specific languages, with general-purpose meta-programming languages.
Original languageEnglish
Title of host publicationProceedings of the Fifth Workshop on Refacturing Tools (WRT'12), June 1, 2012, Rapperswil, Switzerland
Place of PublicationNew York
PublisherAssociation for Computing Machinery, Inc
Pages40-49
ISBN (Print)978-1-4503-1500-5
DOIs
Publication statusPublished - 2012
Externally publishedYes
Eventconference; Fifth Workshop on Refacturing Tools -
Duration: 1 Jan 2012 → …

Conference

Conferenceconference; Fifth Workshop on Refacturing Tools
Period1/01/12 → …
OtherFifth Workshop on Refacturing Tools

Fingerprint

Dive into the research topics of 'Scripting a refactoring with Rascal and Eclipse'. Together they form a unique fingerprint.

Cite this