James J. Hayes, ``A Method for Adapting a Program Analysis Tool to Multiple Source Languages'' , M.S. Thesis, Technical Report CS98-600, Department of Computer Science and Engineering, University of California, San Diego, September 1998.

Warning: this thesis was produced with MS Word and cannot be viewed under some postscript viewers. However, it has printed fine on MS Windows and Sun Unix systems.


Abstract

By providing information about system architecture and object usage, program analysis tools can give useful assistance in understanding software systems when performing tasks such as restructuring, enhancement, and module replacement. To be most useful, these tools need to adapt easily to different source languages. However, program analysis tools are usually tailored to one particular representation of programs written in one particular source language, making adaptation to other languages costly.

This thesis discusses an approach for easing the process of adapting a program analysis tool to different source languages. Our approach involves modifying the tool to work with existing program representations available from compilers or other sources. As part of this modification, we restructure the tool to limit its interaction with the underlying program representation to a small adaptation module interface comprised of two sets of functions: representation functions that synthesize information required by the tool about objects in the representation and language functions that determine program constructs of interest to the tool. Hiding representation and language details behind an adaptation module interface in this manner isolates the changes needed to adapt the tool to a different program representation that supports a different language.

We have applied this approach to the StarTool program analysis tool developed at UCSD. Defining an adaptation module has facilitated retargeting this tool to independent AST generators for C and Ada and to an AST representation of Tcl/Tk programs. Our work shows that defining our adaptation module interface in terms of specific requirements of StarTool, rather than in terms of general-purpose queries, significantly eases the process of retargeting the tool to additional representations and languages.