Program transformation

A program transformation is any operation that takes a computer program and generates another program. In many cases the transformed program is required to be semantically equivalent to the original, relative to a particular formal semantics and in fewer cases the transformations result in programs that semantically differ from the original in predictable ways.[1]

While the transformations can be performed manually, it is often more practical to use a program transformation system that applies specifications of the required transformations. Program transformations may be specified as automated procedures that modify compiler data structures (e.g. abstract syntax trees) representing the program text, or may be specified more conveniently using patterns or templates representing parameterized source code fragments.[2]

A practical requirement for source code transformation systems is that they be able to effectively process programs written in a programming language. This usually requires integration of a full front-end for the programming language of interest, including source code parsing, building internal program representations of code structures, the meaning of program symbols, useful static analyses, and regeneration of valid source code from transformed program representations. The problem of building and integrating adequate front ends for conventional languages (Java, C++, PHP etc.) may be of equal difficulty as building the program transformation system itself because of the complexity of such languages. To be widely useful, a transformation system must be able to handle many target programming languages, and must provide some means of specifying such language-specific front-ends.[3] Spoon[4] is an example of a Java-specific program transformation library that addresses this challenge by providing a full front-end for Java, exposing an AST-based API for implementing analyses and transformations of Java source code.

A generalisation of semantic equivalence is the notion of program refinement: one program is a refinement of another if it terminates on all the initial states for which the original program terminates, and for each such state it is guaranteed to terminate in a possible final state for the original program. In other words, a refinement of a program is more defined and more deterministic than the original program. If two programs are refinements of each other, then the programs are equivalent.[clarification needed]

See also

References

  1. ^ Ward, Martin (1989). Proving Program Refinements and Transformations (DPhil Thesis). Oxford University.{{cite book}}: CS1 maint: location missing publisher (link)
  2. ^ Cordy, James R. (2006). "The TXL source transformation language". Science of Computer Programming. 61 (3): 190–210. doi:10.1016/j.scico.2006.04.002.
  3. ^ Bravenboer, Martin; Kalleberg, Karl Trygve; Vermaas, Rob; Visser, Eelco (2008). "Stratego/XT 0.17. A language and toolset for program transformation". Science of Computer Programming. 72 (1–2): 52–70. doi:10.1016/j.scico.2007.11.003.
  4. ^ Pawlak, Renaud; Monperrus, Martin; Petitprez, Nicolas; Noguera, Carlos; Seinturier, Lionel (2016). "SPOON: A library for implementing analyses and transformations of Java source code". Software: Practice and Experience. 46 (9): 1155–1179. doi:10.1002/spe.2346.


Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.