Concrete Syntax Metapatterns
Open Access
- 17 October 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 43-55
Abstract
Software engineers should be able to apply massive code refactorings to maintain large legacy code bases. A key aspect of developing restructurings is matching and transforming code snippets using abstract syntax trees (ASTs). Matching on ASTs is typically done through AST patterns with holes. AST patterns can be extended to become metapatterns, which increase their expressivity. Metapattern examples include disjunctions, descendant patterns, and patches where we inline transformations into the pattern itself. Despite their expressivity, abstract syntax (meta)patterns can become verbose and require restructuring engineers to be intimately familiar with the data types that define the AST. A better approach is to use concrete syntax patterns, which allows us to denote our patterns in the syntax of the object language. Previous work has shown that we can use external black-box parsers of the object language to compile concrete syntax patterns for arbitrary languages. In this paper, we scale this compilation method to support concrete syntax metapatterns, which allows for a more declarative way of expressing restructurings. We evaluate this method through an implementation written in Kotlin.Keywords
Funding Information
- Nederlandse Organisatie voor Wetenschappelijk Onderzoek ()
- Nederlandse Organisatie voor Toegepast Natuurwetenschappelijk Onderzoek ()
This publication has 11 references indexed in Scilit:
- Automating Program Transformation with Coccinelle2022
- Large‐scale semi‐automated migration of legacy C/C++ test codeSoftware: Practice and Experience, 2022
- High-fidelity metaprogramming with separator syntax trees2020
- An Algorithm for Layout Preservation in Refactoring Transformations2012
- The Spoofax language workbench2010
- RASCAL: A Domain Specific Language for Source Code Analysis and Manipulation2009
- Meta-programming with Concrete Object Syntax2002
- The Asf+Sdf Meta-environment: A Component-Based Language Development Environment2001
- A meta-environment for generating programming environmentsACM Transactions on Software Engineering and Methodology, 1993
- Concrete syntax for data objects in functional languages1988