Example-based Program Querying

Printer-friendly version

Publication Type:

Conference Paper

Source:

Proceedings of the 2008 Working Session on Query Technologies and Applications for Program Comprehension (QTAPC08) at the 16th International Conference on Program Comprehension (ICPC08) (2008)

Keywords:

example-based, lmp, logic meta programming, pattern detection, prolog, templates

Abstract:

<p>Program query languages are an essential component of program analysis and manipulation systems. In each such system, a query identifies the source-code parts of interest by reasoning over a program representation that is dedi- cated to the intent of the system (e.g. call-graphs to de- tect behavioral flaws, abstract syntax trees for refactorings, concrete source code to verify programming conventions, etc.). In order to detect a wide variety of such ``patterns of interest'', or more importantly, to detect patterns that re- quire a combination of such program representations, de- velopers must understand all the different applicable rep- resentations and techniques. We therefore present a logic- based language that allows the program's implementation to be queried using concrete source code templates that are matched against a combination of structural and behavioral program representations. These representations include call-graphs, points-to analysis results and abstract syntax trees that are uniformly composed through a customizable unification procedure. The result of our approach is that de- velopers can detect patterns in the queried program using source code excerpts (embedded in logic queries) which act as prototypical samples of the structure and behavior they intend to match.</p>