Verification and Application of Program Transformations
Program transformations and refactorings are essential elements in software development. From the early days of refactoring, tool support has emerged to provide effortless and trustworthy assistance for quality improvement, behaviour preserving transformations of programs. Both academia and industry have great interest in researching and developing static analysis based bug detection and trustworthy behaviour preserving transformations. Although refactoring tools are getting better day by day, there is room for improvement both in terms of accuracy and reliability. This dissertation investigates definition and verification methods for program transformations, which can help us build more extensible, more trustworthy and widely applied transformations systems. To advance dynamic verification techniques, a novel notation for L attribute grammars is introduced, and is given a meaning in terms of data generator functions, which can be used in various ways in property based testing. The document presents a case study, a grammar for Erlang, and its use in testing an Erlang analysis and transformation system. To address static, formal verification of transformations, a refactoring programming language is proposed as the specification formalism for executable and semi automatically verifiable refactoring definitions. The language is based on context sensitive conditional term rewriting, strategy programming and refactoring schemes. Last but not least, as a special application of graph rewriting and tool assisted program transformation, the dissertation discusses implementation of language pre compilers in refactoring systems. With this method, a portable closure semantics was added to the Erlang programming language, enabling code migration.