Query and inspect your Java, Smalltalk, C and Cobol programs.
Libraries for SOUL » Cava library: query Java programs using SOUL
Cava is a library of predicates for querying Java programs using SOUL. These predicates quantify over an abstract syntax tree representation of the program which stems from the Eclipse JDT Core Component. For each subclass of org.eclipse.jdt.core.dom.ASTNode, the library provides a unary predicate (e.g. isClassDeclaration/1) that quantifies over all AST nodes of this kind. Binary predicates (e.g. classDeclarationHasName:/2) quantify over the relations between each AST node and its children. In addition, the library provides higher-level predicates that quantify over relations between AST nodes that are not explicit in the AST representation. Examples include binary predicate isChildOf:/2 which quantifies over the relation between a node and its descendants or binary predicate inheritsFrom:/2 which quantifies over the inheritance relation between types.
Cava also defines a domain-specific unification procedure for AST nodes. Under this procedure, different AST nodes unify if they implement the same structural or behavioral characteristics. For instance, two expressions unify if they may evaluate to the same object at run-time. To this end, Cava consults the results of whole-program analyses obtained through the SOOT Java optimization framework. Finally, AST nodes unify with structurally equivalent compound terms. Instances of org.eclipse.jdt.core.dom.CastExpression, for instance, unify with compound terms of the form castExpression(?type,?expression) where ?type and ?expression are bound to the children of the CastExpression.
Coen De Roover and Johan Brichau
For now, Chapter 5 of Coen De Roover's Phd thesis A Logic Meta Programming Foundation for Example-Driven Pattern Detection in Object-Oriented Programs describes Cava best. Chapter 6 describes the domain-specific unification procedure that comes with Cava.
The latest version of Cava can be installed by loading the bundle named 'Soul-Cava' from our DMP store in a fresh Smalltalk image.
The following bundles will be loaded automatically from the DMP store as well:
The following libraries can be loaded manually to further enhance the functionality of Cava: