Semantic code browsing

García Contreras, Isabel and Morales Caballero, José Francisco and Hermenegildo, Manuel V. (2016). Semantic code browsing. "Theory and Practice of Logic Programming", v. 16 (n. 5-6); pp. 721-737. ISSN 1471-0684.


Title: Semantic code browsing
  • García Contreras, Isabel
  • Morales Caballero, José Francisco
  • Hermenegildo, Manuel V.
Item Type: Article
Event Title: 32nd International Conference on Logic Programming (ICLP 2016)
Event Dates: 16-21 Oct 2016
Event Location: Nueva York
Title of Book: Theory and Practice of Logic Programming
Título de Revista/Publicación: Theory and Practice of Logic Programming
Date: 2016
ISSN: 1471-0684
Volume: 16
Freetext Keywords: Semantic Code Search; Abstract Interpretation; Assertions
Faculty: E.T.S. de Ingenieros Informáticos (UPM)
Department: Inteligencia Artificial
Creative Commons Licenses: Recognition - No derivative works - Non commercial

Full text

PDF - Requires a PDF viewer, such as GSview, Xpdf or Adobe Acrobat Reader
Download (1MB) | Preview


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.

Funding Projects

Government of SpainTIN2012-39391StrongSoftUniversidad Complutense de MadridTecnologías rigurosas para software de nueva generación abierto y fiable
Madrid Regional GovernmentTIN2015-67522-C3-1-RTRACESIMDEATecnologías y herramientas para el desarrollo de software consciente de los recursos, correcto y eficiente (IMDEA)
Madrid Regional GovernmentM141047003UnspecifiedUniversidad Politécnica de MadridN-GREENS program
FP7318337ENTRAUnspecifiedWhole-Systems Energy Transparency

More information

Item ID: 52864
DC Identifier:
OAI Identifier:
DOI: 10.1017/S1471068416000417
Official URL:
Deposited by: Biblioteca Facultad de Informatica
Deposited on: 29 Oct 2018 17:07
Last Modified: 25 Mar 2019 16:12
  • Logo InvestigaM (UPM)
  • Logo GEOUP4
  • Logo Open Access
  • Open Access
  • Logo Sherpa/Romeo
    Check whether the anglo-saxon journal in which you have published an article allows you to also publish it under open access.
  • Logo Dulcinea
    Check whether the spanish journal in which you have published an article allows you to also publish it under open access.
  • Logo de Recolecta
  • Logo del Observatorio I+D+i UPM
  • Logo de OpenCourseWare UPM