A Language Generic Solution for Name Binding Preservation in Refactorings

January 20, 2012

Paper about refactoring support for Spoofax accepted at LDTA’12:

Maartje de Jonge, Eelco Visser. A Language Generic Solution for Name Binding Preservation in Refactorings. In Suzana Andova, Anthony M. Sloane, editors, Workshop on Language Descriptions, Tools, and Applications, Proceedings. 2012.

Abstract: The implementation of refactorings for new languages requires considerable effort from the language developer. We aim at reducing that effort by using language generic techniques. This paper focuses on behavior preservation, in particular the preservation of name bindings. Given an existing name analysis, we implement a language generic technique to detect name binding violations. Some languages offer the possibility to access global variables using qualified names. As a refinement to violation detection, we show that name analysis can be defined as a reusable traversal strategy that can be applied to restore name bindings by creating qualified names. These techniques offer an efficient and reliable solution; the semantics of the language is implemented only once, with the compiler being the single source of truth. We evaluate our approach by implementing a language generic rename refactoring, which we apply to different languages.