High-fidelity metaprogramming with separator syntax trees

4Citations
Citations of this article
4Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Many metaprogramming tasks, such as refactorings, automated bug fixing, or large-scale software renovation, require high-fidelity source code transformations-transformations which preserve comments and layout as much as possible. Abstract syntax trees (ASTs) typically abstract from such details, and hence would require pretty printing, destroying the original program layout. Concrete syntax trees (CSTs) preserve all layout information, but transformation systems or parsers that support CSTs are rare and can be cumbersome to use. In this paper we present separator syntax trees (SSTs), a lightweight syntax tree format, that sits between AST and CSTs, in terms of the amount of information they preserve. SSTs extend ASTs by recording textual layout information separating AST nodes. This information can be used to reconstruct the textual code after parsing, but can largely be ignored when implementing high-fidelity transformations. We have implemented SSTs in Rascal, and show how it enables the concise definition of high-fidelity source code transformations using a simple refactoring for C++.

Cite

CITATION STYLE

APA

Aarssen, R. T. A., & Van Der Storm, T. (2020). High-fidelity metaprogramming with separator syntax trees. In PEPM 2020 - Proceedings of the 2020 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, co-located with POPL 2020 (pp. 27–37). Association for Computing Machinery, Inc. https://doi.org/10.1145/3372884.3373162

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free