Renaming for Everyone - Language-parametric Renaming in Spoofax

Phil Misteli

Date: Tue, May 25, 2021
Time: 14:00
Room: Eelco's Zoom Room
Note: This is a MSc thesis defense

A refactoring is a program transformation that improves the design of the source code, while preserving its behavior. Most modern IDEs offer a number of automated refactorings as editor services. However, correctly implementing refactorings is notoriously complex, and these state-of-the-art implementations are known to be faulty and too restrictive. Rename is the most-commonly applied refactoring and is used to change the identifier of a language entity such as a variable, a function or a type. Spoofax is a language workbench that allows language engineers to define languages through declarative specifications. When developing a new programming language, it is both difficult and time-consuming to implement automated refactoring transformations. Therefore having an out-of-the-box Rename refactoring would be of great help, as new languages often lack such tool support. We developed a sound language-parametric Rename refactoring algorithm that works on an abstract model of a program’s name binding structure. We implemented that algorithm in Spoofax, using the Stratego transformation language. We successfully tested the algorithm on five different languages implemented in Spoofax, which use both NaBL2 and Statix to declare their static semantics and name binding rules. As a result, Spoofax now offers language engineers an automated Rename refactoring that works for whatever language they might develop.

Max Schaefer. “Specification, implementation and verification of refactorings”. PhDthesis. University of Oxford, UK, 2010. url:

Pierre Neron et al. “A Theory of Name Resolution”. In:Programming Languages andSystems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the Euro-pean Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April11-18, 2015. Proceedings. 2015, pp. 205–231.doi:10.1007/978-3-662-46669-8_9. url:

Hendrik van Antwerpen et al. “A constraint language for static semantic analysisbased on scope graphs”. In:Proceedings of the 2016 ACM SIGPLAN Workshop on Par-tial Evaluation and Program Manipulation, PEPM 2016, St. Petersburg, FL, USA, January20 - 22, 2016. 2016, pp. 49–60.doi:10.1145/2847538.2847543. url:

Previous: Bernard Bot |
Next: t.b.a. |