Copenhagen Programming Language Seminar

Program Queries using Logic-based, Concrete Source-Code Templates

Johan Brichau and Coen de Roover
Université catholique de Louvain, Belgium, and Vrije Universiteit Brussel, Belgium, respectively

Wednesday (!), March 28, 10:15-12:00 (!)
DIKU, Universitetsparken 1, Room N018


Program query languages are effective means to navigate and reason about the implementation of large-scale software systems. In the context of advanced software development tools, program queries are therefore often used to discover, document and verify regularities (such as design patterns, coding conventions, etc.) in the implementation of the software. The Smalltalk Open Unification Language (SOUL) is such a program query language that uses a hybrid combination of Prolog and Smalltalk to reason about the implementation of object-oriented source code.

In our experiences with SOUL in the context of a wide variety of software development tools, we have observed that the accurate specification of a program query can often become very complex. At the core of this problem lies the observation that developers specify queries based on a concrete set of source-code entities they wish to document or discover in the system. In other words, software developers tend to understand queries not directly through their specification but through the tangible source code entities they look for. This dichotomy requires that developers convey their example-driven knowledge into operational queries. This is often further complicated with the fact that the specification of the query may need diverse structural and behavioral representations of the program.

We have reconciled the example-driven knowledge of developers with the expressive power of program queries by means of embedding concrete source code templates in a logic query language. These templates permit to describe complex program queries merely through a specification of a prototypical example implementation. Such template-based program queries are then resolved through an automatic translation of the templates to queries that act upon diverse structural and behavioral representations of the program. In particular, these queries are matched against a combination of call-graphs, points-to analysis results and abstract syntax trees.

(The talk will be in two parts. The first, starting at 10:15, will cover declarative metaprogramming with SOUL, focusing on practical examples and context. The second, starting at 11:15, will be a more in-depth technical discussion of template matching.)

Scientific host: Julia Lawall. Administrative host: Camilla Torp-Smith. All are welcome.
The Copenhagen Programming Language Seminar (COPLAS) is a collaboration between DIKU, ITU, KVL and RUC.
COPLAS is sponsored by the FIRST Graduate School.
To receive information about COPLAS talks by email, send a message to prog-lang-request@mail.it-c.dk with the word 'subscribe' as subject or in the body.

For more information about COPLAS, see http://www.coplas.org