Print Email Facebook Twitter Function Inlining as a Language Parametric Refactoring Title Function Inlining as a Language Parametric Refactoring Author van der Gugten, Loek (TU Delft Electrical Engineering, Mathematics and Computer Science; TU Delft Programming Languages) Contributor Miljak, L. (mentor) Poulsen, C.B. (graduation committee) van Deursen, A. (graduation committee) Degree granting institution Delft University of Technology Programme Computer Science Project Programming and Validating Software Restructurings (NWO MasCot project) Date 2022-06-22 Abstract Refactorings are program transformations that preserve the observable behavior of the program. The refactoring function inlining replaces a function call with the contents of the referenced function definition. To preserve the behavior, properties such as reference relations must be retained and language constructs like 'return' statements must be replaced. Implementing a behavior preserving refactoring is a time-consuming and error-prone task. In the past, such refactorings have only been implemented for one language at a time, thus they cannot be reused in other languages.This thesis presents a language parametric function inlining algorithm that can be applied to any language. The algorithm performs function inlining and checks the transformed program for static semantics errors and changes to reference relations that would cause a change to the behavior of the program, fixing them where possible. The required language parameters are an AST parser, a static semantics analyzer that can derive reference relations, and a set of language-specific functions that can perform language-specific tasks, for example identifying return statements.An implementation of the algorithm is provided in the language workbench Spoofax using the transformation language Stratego. It can be applied to all languages with an SDF3 defined grammar and a Statix semantics analyzer. The implementation is tested on C++, WebDSL and Tiger using unit tests. Subject RefactoringLanguageParametricGenericSpoofaxStrategoInlineFunctionInliningStatixReference RelationVariable CaptureControl Flow To reference this document use: http://resolver.tudelft.nl/uuid:15057a42-f049-4321-b9ee-f62e7f1fda9f Part of collection Student theses Document type master thesis Rights © 2022 Loek van der Gugten Files PDF final_version.pdf 715.81 KB Close viewer /islandora/object/uuid:15057a42-f049-4321-b9ee-f62e7f1fda9f/datastream/OBJ/view