Abstract-Extracting information from the source code of a program is an important step in the way to program understanding, manipulation, development and maintenance. To this end, logic-based query languages provide a declarative manner in which to identify program elements of interest. In this paper we present BARISTA, a tool-suite for querying Java programs based on the Smalltalk Open Unification Language (SOUL). BARISTA offers programmers an advanced IDE to write queries and navigate their results. Tool builders can benefit from SOUL querying facilities by exploiting the on demand code querying and query scheduling services offered by BARISTA.
I. INTRODUCTIONProgram queries identify program elements that exhibit characteristics of interest. Logic formulas can be used as expressive and descriptive specifications of these characteristics. This merely requires reifying the program under investigation such that logic variables can range over its elements. Executing a proof procedure will then establish whether program elements exhibit the characteristics specified in a formula. This logic-based approach to program querying is widespread in literature (usually based on Prolog [6] or Datalog [3]). We will focus on querying Java programs using the latest incarnation of SOUL [8], one of the earliest logic program query languages that is still under active development.Tool builders that require gathering information on the structure and behaviour of a system, can benefit from advanced program query facilities. Consider implementing a tool for a Java IDE that highlights repeated string concatenations where a StringBuilder would be more appropriate. Usually, this entails telling the IDE to mark some of its AST nodes. We therefore have to find those AST nodes that correspond to repeated string concatenations. Invoking the search API of the IDE is, on one hand cumbersome since the characteristics of the sough pattern must be described imperatively and on the other, only a feasible option in case the sought after AST nodes are characterized behaviorally. However, existing search APIs do not support control flow and data flow characteristics required to effectively track the values being concatenated across the execution of the application. Employing a logicbased query language would remedy the first shortcoming of IDE's search APIs, but provide no help regarding the second one. Furthermore, since most logic-based program query approaches represent the program's source code as a set of terms, it is up to the tool developer to translate the results of the query back to AST nodes for further processing.