James Hayes, William G. Griswold, Stuart Moskovics, ``Designing for Retargetability of a Program Analysis Tool by Reusing Intermediate Representations'', Technical Report CS99-614, Department of Computer Science and Engineering, University of California, San Diego, March 1999.


Abstract

An interactive program analysis tool is most useful if it can be easily adapted to different source languages. How-ever, these tools are often tailored to one particular representation of programs, making adaptation to a new language costly. An inexpensive way of achieving adaptability is to introduce an intermediate an adaptation between an existing language representation and the program analysis tool that translates the tool's queries into queries on the particular representation.

We experimented with this approach in making our StarTool program analysis tool retargetable. The approach proved successful, resulting in low-cost retargets for C, Tcl/Tk, and Ada. However, some unanticipated adjustments to the approach were required, providing insights for making a client retargetable. First, the adaptation layer exports two interfaces, a representation interface that supports queries on the represented program and a language interface that the client queries to configure itself to behave appropriately for the given language. Second, retargeting is eased if the program analysis tool is designed to import a tool-centric (i.e., client-centric) interface rather than a general-purpose, language-neutral language representation service interface. Straightforward object-oriented extensions enhance reuse and facilitate the development of multi-language tools.