Features of SOUL

SOUL is a logic programming language with domain-specific features (e.g., template conditions and domain-specific unification) for querying the source code of other programs. Most of these features  are motivated by the desire to use SOUL for detecting implementation-level software patterns in Java and Smalltalk programs: 

Implementation-level software patterns describe source code that exhibits structural (e.g., inter-class relationships such as inheritance) and behavioral characteristics (i.e., the order in which instructions are executed run-time and the values operated upon by these instructions) of interest. The reading from a closed file, for instance, is characterized behaviourally by two instructions x.close() and y.read() that are executed sequentially and operate on the same file. Possible violations of the invariant that equal objects must have equal hash codes, in contrast, are characterized structurally by a custom hashCode() method without a corresponding equals(Object) method. Clearly, a tool for detecting such patterns has valuable applications in a quality assurance setting. This is even more so for tools that support detecting user-specified patterns. Among others, such tools can be used to enforce coding conventions or detect violations of the specific protocol an API expects to be adhered to.

SOUL can easily be adopted as an advanced pattern detection tool. A logic program query, consisting of conditions that quantify over a program's source code, can be used to specify the characteristics of a software pattern. It suffices to execute such a program query to find source code that exhibits the pattern's characteristics. The motivating example illustrates the shortcomings of regular logic program queries that are overcome by the domain-specific features of SOUL.