Concrete Syntax Metapatterns

Research output: Chapter in Book/Conference proceedings/Edited volumeConference contributionScientificpeer-review

57 Downloads (Pure)

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.

Original languageEnglish
Title of host publicationSLE 2024 - Proceedings of the 17th ACM SIGPLAN International Conference on Software Language Engineering, Co-located with
Subtitle of host publicationSPLASH 2024
EditorsRalf Laemmel, Juliana Alves Pereira, Peter D. Mosses, Peter D. Mosses
PublisherACM
Pages43-55
Number of pages13
ISBN (Electronic)9798400711800
DOIs
Publication statusPublished - 2024
Event17th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2024, Co-located with: SPLASH 2024 - Pasadena, United States
Duration: 20 Oct 202421 Oct 2024

Publication series

NameSLE 2024 - Proceedings of the 17th ACM SIGPLAN International Conference on Software Language Engineering, Co-located with: SPLASH 2024

Conference

Conference17th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2024, Co-located with: SPLASH 2024
Country/TerritoryUnited States
CityPasadena
Period20/10/2421/10/24

Keywords

  • black-box parsers
  • concrete syntax
  • metaprogramming
  • refactoring
  • restructuring

Fingerprint

Dive into the research topics of 'Concrete Syntax Metapatterns'. Together they form a unique fingerprint.

Cite this