This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
A Framework for Source Code Search Using Program Patterns
June 1994 (vol. 20 no. 6)
pp. 463-475

For maintainers involved in understanding and reengineering large software, locating source code fragments that match certain patterns is a critical task. Existing solutions to the problem are few, and they either involve manual, painstaking scans of the source code using tools based on regular expressions, or the use of large, integrated software engineering environments that include simple pattern-based query processors in their toolkits. We present a framework in which pattern languages are used to specify interesting code features. The pattern languages are derived by extending the source programming language with pattern-matching symbols. We describe SCRUPLE, a finite state machine-based source code search tool, that efficiently implements this framework. We also present experimental performance results obtained from a SCRUPLE prototype, and the user interface of a source code browser built on top of SCRUPLE.

[1] A. Aho, B. Kernighan, and P. Weinberger,The Awk Programming Language. Reading, MA: Addison-Wesley, 1988.
[2] R. Al-Zoubi and A. Prakash, "Software change analysis via attributed dependency graphs," Tech. Rep CSE-TR-95-91, Dept. of EECS, Univ. of Michigan, May 1991. Also inSoftware Maintenance, to be published.
[3] J. Ambras and V. O'Day, "Microscope: A program analysis system," inProc. 20th Hawaii Inter. Conf. Syst. Sci., 1987, pp. 460-468.
[4] H. L. Berghel and D. L. Sallach, "Measurements of program similarity in identical tasking environments,"SIGPLAN Notices, vol. 19, no. 8, 1984.
[5] R.S. Boyer and J. Moore, "A Fast String Searching Algorithm,"Comm. ACM, Vol. 20, Oct. 1977, pp. 762-772.
[6] R. Brooks, "Towards a theory of comprehension of computer programs,"Int. J. Man-Machine Studies, vol. 18, pp. 543-55, 1983.
[7] Y. Chen, M. Y. Nishimoto and C. V. Ramamoorthy, "The C information abstraction system,"IEEE Trans. Software Eng., vol. 16, no. 3, pp. 325-334, Mar. 1990.
[8] J. R. Cordy, C. D. Halpern-Hamu, and E. Promislow, "TXL: A rapid prototyping system for programming language dialects,"Comput. Lang., vol. 16, no. 1, pp. 97-107, 1991.
[9] D. Garlan, L. Cai and R. L. Nord, "A transformational approach to generating application-specific environments," inProc. SIGSOFT, 1992.
[10] J. E. Grass, "Object-Oriented Design Archaeology with CIA++,"Comput. Syst. J. USENIX Assn., vol. 5, no. 1, pp. 5-67, Winter 1992.
[11] S. Grier, "A Tool that detects plagiarism in Pascal Programs,"SIGSCE Bulletin, vol. 13, no. 1, 1981.
[12] M. Halstead,Elements of Software Science. New York: Elsevier-North Holland, 1977.
[13] J.E. Hopcroft and J.D. Ullman,Introduction to Automata Theory, Languages, and Computation, Addison-Wesley, Reading, Mass., 1979.
[14] H. T. Jankowitz, "Detecting plagiarism in student pascal programs,"The Comput. J., vol. 31, no. 1, 1988.
[15] R. M. Karp and M. O. Rabin, "Efficient randomized pattern matching algorithm," Tech. Rep. TR-31-81, Aiken Computation Lab., Harvard Univ., 1981.
[16] B. W. Kernighan and R. Pike,The Unix Programming Environment, Prentice-Hall, Englewood Cliffs, N.J., 1984.
[17] D. E. Knuth, J. H. Morris, and V. R. Pratt, "Fast pattern matching in strings."SIAM J. Comput., vol. 6, no. 2, pp. 323-350, 1977.
[18] G. B. Kotik and L. Z. Markosian, "Automating software analysis and testing using a program transformation system," inProc. ACM SIGSOFT, 1989, pp. 75-84.
[19] W. Kozaczynsky, J. Ning and A. Engberts, "Program concept recognition and transformation."IEEE Trans. Software Eng., vol. 18, no. 12, pp. 1065-1075, Dec. 1992.
[20] M. A. Linton, "ImpIementing relational views of programs," inSIGSOFT/SIGPLAN Software Engineering Symp. Practical Software Development Environments, Pittsburgh, PA, Apr. 1984, pp. 132-140, see alsoSIGSOFT Software Eng. Notes, vol. 9, no. 3, May 1984; see alsoSIGPLAN Notices, vol. 19, no. 5, May 1984.
[21] N. H. Madhavji, "Compare: A collusion detector for pascal,"Technique et Science Informatiques, vol. 4, no. 6, pp. 489-498, Nov. 1985.
[22] T. J. McCabe, "A Complexity Measure,"IEEE Trans. Software Eng., vol. SE-2, pp. 308-320, Dec. 1976.
[23] H. A. Muller, B. D. Carrie, and S. R. Tilley, "Spatial and visual representations of software structures: A model for reverse engineering," Tech. Rep. TR-74, 086, IBM Canada Ltd., Apr. 1992.
[24] S. Paul, "SCRUPLE: A re-engineer's tool for source code search," inProc. CAS Conf., IBM Canada Ltd. Lab., Centre for Adv. Studies, 1992.
[25] S. Paul, "Theory and design of source code query systems," Ph.D. thesis, Univ. of Michigan, 1994. In preparation.
[26] S. Paul and A. Prakash, "Source code retrieval using program patterns," inProc. 5th Int. Conf. Comput. Aided Software Eng., 1992, pp. 95-105.
[27] D. E. Perry, "Software interconnection models," inProc. 9th Int. Conf. Software Engineering, Monterey, CA, Mar. 1987, pp. 61-69.
[28] Reasoning Systems, Palo Alto, CA,REFINE User's Guide, 1989.
[29] R. Sedgewick,Algorithms in C. Reading, MA: Addison-Wesley, 1990, chapter 20.
[30] D. Swanberg, C. F. Shu, and R. Jain, "Knowledge guided parsing in video databases," inImage and Video Processing Conf.; Symp. Electronic Imaging: Sci.&Tech., IS&T/SPIE, vol. 1908, San Jose, CA, February 1993, pp. 13-24.
[31] S. Westfold, "Pattern Matching in REFINE." Personal Communication, June 1993.

Index Terms:
software maintenance; query languages; software tools; programming environments; formal specification; finite state machines; user interfaces; source code search; program patterns; software maintenance; software understanding; software reengineering; source code fragments; source code; software tools; integrated software engineering environments; pattern-based query processors; software toolkits; pattern languages; source programming language; SCRUPLE; source code search tool; finite state machine; prototype; user interface; source code browser
Citation:
S. Paul, A. Prakash, "A Framework for Source Code Search Using Program Patterns," IEEE Transactions on Software Engineering, vol. 20, no. 6, pp. 463-475, June 1994, doi:10.1109/32.295894
Usage of this product signifies your acceptance of the Terms of Use.