Source code querying tools allow programmers to explore relations between different parts of the code base. This paper describes such a tool, named CodeQuest. It combines two previous proposals, namely the use of logic programming and database systems. As the query language we use safe Datalog, which was originally introduced in the theory of databases.… (More)
Navigate code, find bugs, compute metrics, check style rules, and enforce coding conventions in Eclipse with SemmleCode. SemmleCode is a new free Eclipse plugin that allows you to phrase these tasks as queries over the codebase - it thus takes the search facilities in Eclipse to a whole new level. A large library of queries for common operations is… (More)
These notes are an introduction to .QL, an object-oriented query language for any type of structured data. We illustrate the use of .QL in assessing software quality, namely to find bugs, to compute metrics and to enforce coding conventions. The class mechanism of .QL is discussed in depth, and we demonstrate how it can be used to build libraries of… (More)
In aspect-oriented programming, one can intercept events by writing patterns called <i>pointcuts</i>. The pointcut language of the most popular aspect-oriented programming language, AspectJ, allows the expression of highly complex properties of the static program structure.We present the first rigorous semantics of the AspectJ pointcut language, by… (More)
Many tasks in source code analysis can be viewed as evaluating queries over a relational representation of the code. Here we present an object-oriented query language, named .QL, and demonstrate its use for general navigation , bug finding and enforcing coding conventions. We then focus on the particular problem of specifying metrics as queries.
We describe <i>CodeQuest</i>, a system for querying source code. It combines two previous proposals, namely the use of logic programming and database system. Experiments (on projects ranging from 3KSLOC to 1300KSLOC) confirm that for this application, a query language based on DataLog strikes the right balance between expressiveness and scalability.
A trace monitor observes the sequence of events in a system, and takes appropriate action when a given pattern occurs in that sequence. Aspect-oriented programming provides a convenient framework for writing such trace monitors. We provide a brief introduction to aspect-oriented programming in AspectJ. As-pectJ only provides support for triggering extra… (More)
AspectJ's pointcut language is complex, yet often not expressive enough to directly capture a desired property. Prolog has been suggested as an alternative, but Prolog queries may not terminate, and they tend to be verbose. We solve expressiveness, termination and verbosity by using <i>Datalog</i> plus <i>rewrite rules</i>.
Code queries are useful for enforcing coding conventions, navigating a large code base, and for identifying locations to refactor. The program understanding community has long advocated the use of a relational database to facilitate such code queries [3, 9]. While the idea has found some uptake in industry [2, 11], relational queries over code have not yet… (More)