Balázs Szalontai, Péter Bereczky and Dániel Horpácsi
Deep Learning-Based Refactoring with Formally Verified Training Data
Refactoring source code has always been an active area of research. Since the uprising of various deep learning methods, there have been several attempts to perform source code transformation with the use of neural networks. More specifically, Encoder-Decoder architectures have been used to transform code similarly to a Neural Machine Translation task. In this paper, we present a deep learning-based method to refactor source code, which we have prototyped for Erlang. Our method has two major components: a localizer and a refactoring component. That is, we first localize the snippet to be refactored using a recurrent network, then we generate an alternative with a Sequence-to- Sequence architecture. Our method could be used as an extension for already existing AST-based approaches for refactoring since it is capable of transforming syntactically incomplete code. We train our models on automatically generated data sets, based on formally verified refactoring definitions and by using attribute grammar-based sampling.
Please cite this paper the following way:
Balázs Szalontai, Péter Bereczky and Dániel Horpácsi, "Deep Learning-Based Refactoring with Formally Verified Training Data", Infocommunications Journal, Special Issue on Applied Informatics, 2023, pp. 2-8, https://doi.org/10.36244/ICJ.2023.5.1