Re-engineering C++ Component Models Via Automatic Program Transformation Robert L. Akers, Ph.D. lakers@semdesigns.com Ira D. Baxter, Ph.D. idbaxter@semdesigns.com Semantic Designs Inc. Brian J. Ellis Kenn R. Luecke The Boeing Company Michael Mehlich, Ph.D. mmehlich@semdesigns.com Abstract Automated program transformation holds promise for a variety of software life cycle endeavors, particularly where the size of legacy systems makes code analysis, re-engineering, and evolution difficult and expensive. But constructing highly scalable transformation tools supporting modern languages in full generality is itself a painstaking and expensive process. This cost can be managed by developing a common transformation system infrastructure re- useable by derived tools that each address specific tasks, thus leveraging the infrastructure costs. This paper describes the Design Maintenance System (DMS 1 ), a practical, commercial program analysis and transformation system, and discusses how it was employed to construct a custom modernization tool being applied to a large C++ industrial avionics system. The tool transforms components developed in a 1990’s-era component style to a more modern CORBA-like component framework, preserving functionality. Keywords: software transformation, software analysis, C++, migration, component architectures, legacy systems, compilers, re-engineering, abstract syntax trees, patterns, rewrite rules. 1. Introduction DMS is a mature infrastructure for doing analysis and transformation of software based on deep semantic understanding of programs. It supports virtually all conventional software languages and can be applied to systems built from multiple coding and design languages. The Boeing Migration Tool (BMT), built using the DMS infrastructure, automatically transforms the component framework of a large C++ avionics system from a 1990’s era model to one based 1 DMS is a registered trademark of Semantic Designs Inc. on a proprietary variant of the Common Object Resource Broker Architecture (CORBA), preserving functionality but introducing regular interfaces for inter-component communication. We describe the DMS infrastructure and the BMT application itself to provide insight into how transformation technology can address software analysis and evolution problems where scale, complexity, and custom needs are barriers. We illustrate some of the kinds of syntheses and transformations required and some of the issues involved with transforming industrial C++ code. We also discuss the development experience, including the strategies for approaching the scale of the migration, the style of interaction that evolved between the tool- building company and its industrial customer, and how the project adapted to changing requirements. We present Boeing’s assessment of the project, assess the return on investment of the automated migration strategy, and present some reflections on the experience to guide others considering large scale code re-engineering projects. 2. The DMS Software Reengineering Toolkit DMS provides an infrastructure for software transformation based on deep semantic understanding of programs. Programs are internalized via DMS- generated parsers that exist for virtually all conventional languages. Analyses and manipulations are performed on abstract syntax tree (AST) representations of the programs, and transformed programs are printed with prettyprinters for the appropriate languages. The Toolkit can accept and simultaneously utilize definitions of multiple, arbitrary specification and implementation languages (domains) and can apply analyses and transformations to source code written in any combination of defined domains. Transformations may be either written as procedural code or expressed as source-to-source rewrite rules in an enriched syntax