scispace - formally typeset
Open AccessPosted Content

Semantic Code Browsing

TLDR
In this article, an assertion-based code query language is used to express desired semantic characteristics of the code as partial specifications, which are then compared with the inferred semantics for program elements.
Abstract
Programmers currently enjoy access to a very high number of code repositories and libraries of ever increasing size. The ensuing potential for reuse is however hampered by the fact that searching within all this code becomes an increasingly difficult task. Most code search engines are based on syntactic techniques such as signature matching or keyword extraction. However, these techniques are inaccurate (because they basically rely on documentation) and at the same time do not offer very expressive code query languages. We propose a novel approach that focuses on querying for semantic characteristics of code obtained automatically from the code itself. Program units are pre-processed using static analysis techniques, based on abstract interpretation, obtaining safe semantic approximations. A novel, assertion-based code query language is used to express desired semantic characteristics of the code as partial specifications. Relevant code is found by comparing such partial specifications with the inferred semantics for program elements. Our approach is fully automatic and does not rely on user annotations or documentation. It is more powerful and flexible than signature matching because it is parametric on the abstract domain and properties, and does not require type definitions. Also, it reasons with relations between properties, such as implication and abstraction, rather than just equality. It is also more resilient to syntactic code differences. We describe the approach and report on a prototype implementation within the Ciao system. Under consideration for acceptance in TPLP.

read more

Citations
More filters
Proceedings ArticleDOI

Semantic code search via equational reasoning

TL;DR: This work presents a new approach to semantic code search based on equational reasoning, and the Yogo tool implementing this approach, which can find equivalent code in multiple languages from a single query.
Posted Content

Automatic Generation of Text Descriptive Comments for Code Blocks

TL;DR: In this article, a new recursive neural network called Code-RNN is proposed to extract features from the source code and embed them into one vector, which is then fed to a new recurrent neural network (Code-GRU).
Journal ArticleDOI

Implementation-independent function reuse

TL;DR: An approach is proposed that facilitates functions’ description, publication, and exploration by modeling and publishing abstract function descriptions and their links to concrete implementations and enables implementations’ automatic instantiation by exploiting those published descriptions, and improves developer experience for function exploration and implementation instantiation.
Book ChapterDOI

Computing Abstract Distances in Logic Programs

TL;DR: This work surveys and extends existing proposals for distances and metrics in lattices or abstract domains, and proposes metrics for some common domains used in logic program analysis, as well as extensions of those metrics to the space of whole program analysis.
References
More filters
Proceedings ArticleDOI

Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints

TL;DR: In this paper, the abstract interpretation of programs is used to describe computations in another universe of abstract objects, so that the results of abstract execution give some information on the actual computations.
Journal ArticleDOI

An information retrieval approach for automatically constructing software libraries

TL;DR: A technology for automatically assembling large software libraries which promote software reuse by helping the user locate the components closest to her/his needs is described.
Proceedings ArticleDOI

Semantics-based code search

TL;DR: This work lets users specify what they are looking for as precisely as possible using keywords, class or method signatures, test cases, contracts, and security constraints, and an open set of program transformations to map retrieved code into what the user asked for.
Journal ArticleDOI

A practical framework for the abstract interpretation of logic programs

TL;DR: This work develops a general framework which is suited to develop complex applications and to prove their correctness, and presents a generic abstract interpretation procedure for the construction of such an abstract and-or graph.
Journal ArticleDOI

Compile-time derivation of variable dependency using abstract interpretation

TL;DR: A new algorithm for doing abstract interpretation in logic programs is described which concentrates on inferring the dependencies of the terms bound to program variables with increased precision and at all points in the execution of the program, rather than just at a procedure level.
Related Papers (5)