Abstract

Transformations between source codes, such as refactorings and program analysis, are frequently used in software engineering. Typically, transformations are effectively implemented using an abstract syntax tree (AST) on the origin source code. However, a critical limitation of ASTs is the loss of layout information such as whitespace and comments, which can result in poor readability. To overcome this shortcoming, this paper proposes a bidirectional transformation (BX) method that maintains consistency in the layout between the origin and transformed. First, a section of origin source code will be translated to a concrete syntax tree (CST) that includes layout information. Second, to make the BX practical, a new method is constructed that matches an AST with its respective CST. Finally, to get a reasonable CST, a method to amend the CST is also provided. We prove that the BX is well-behaved, which implies that it satisfies both the PutGet and GetPut laws. Furthermore, we illustrate the correctness of the methodology by treating XML language as a case study.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.