skip to main content
10.1145/2491956.2462192acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Complete completion using types and weights

Authors Info & Claims
Published:16 June 2013Publication History

ABSTRACT

Developing modern software typically involves composing functionality from existing libraries. This task is difficult because libraries may expose many methods to the developer. To help developers in such scenarios, we present a technique that synthesizes and suggests valid expressions of a given type at a given program point. As the basis of our technique we use type inhabitation for lambda calculus terms in long normal form. We introduce a succinct representation for type judgements that merges types into equivalence classes to reduce the search space, then reconstructs any desired number of solutions on demand. Furthermore, we introduce a method to rank solutions based on weights derived from a corpus of code. We implemented the algorithm and deployed it as a plugin for the Eclipse IDE for Scala. We show that the techniques we incorporated greatly increase the effectiveness of the approach. Our evaluation benchmarks are code examples from programming practice; we make them available for future comparisons.

References

  1. A. Bove, P. Dybjer, and U. Norell. A brief overview of Agda - a functional language with dependent types. In TPHOLs, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. V. Breazu-Tannen, T. Coquand, C. A. Gunter, and A. Scedrov. Inheritance as implicit coercion. Inf. Comput., 93: 172--221, July 1991. ISSN 0890--5401. 10.1016/0890--5401(91)90055--7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Bruch, M. Monperrus, and M. Mezini. Learning from examples to improve code completion systems. In ESEC/SIGSOFT FSE, pages 213--222, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Chatterjee, S. Juvekar, and K. Sen. SNIFF: A search engine for java using free-form queries. FASE'09, pages 385--400, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Delahaye. Information retrieval in a Coq proof library using type isomorphisms. In TYPES, pages 131--147, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. G. Dowek. Higher-order unification and matching. Handbook of automated reasoning, II: 1009--1062, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. G. Dowek and Y. Jiang. Enumerating proofs of positive formulae. Comput. J., 52 (7): 799--807, Oct. 2009. ISSN 0010--4620. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Eclipse Code Recommenders. http://www.eclipse.org/recommenders/.Google ScholarGoogle Scholar
  9. M. Ferrari, C. Fiorentini, and G. Fiorino. fCube: An efficient prover for intuitionistic propositional logic. In LPAR (Yogyakarta), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. T. Gvero, V. Kuncak, and R. Piskac. Interactive synthesis of code snippets (tool demonstration). In 23rd Int. Conf. Computer Aided Verification, July 14--20, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. On complete completion using types and weights. Technical report, EPFL, December 2012.Google ScholarGoogle Scholar
  12. Hayoo! API Search. http://holumbus.fh-wedel.de/hayoo/hayoo.html.Google ScholarGoogle Scholar
  13. R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. ICSE'05, pages 117--125, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Hoogle API Search. http://www.haskell.org/hoogle/.Google ScholarGoogle Scholar
  15. IntelliJ IDEA website, 2011. URL http://www.jetbrains.com/idea/.Google ScholarGoogle Scholar
  16. I. Kuraj. Interactive code generation. Master's thesis, EPFL, February 2013.Google ScholarGoogle Scholar
  17. Z. Luo. Coercions in a polymorphic type system. phMathematical Structures in Computer Science, 18 (4): 729--751, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. Mandelin, L. Xu, R. Bodík, and D. Kimelman. Jungloid mining: helping to navigate the api jungle. In phPLDI, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. McLaughlin and F. Pfenning. Efficient intuitionistic theorem proving with the polarized inverse method. In CADE, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, pages 275--286, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. C. Reynolds. Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation, pages 211--258, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Sahavechaphan and K. Claypool. Xsnippet: mining for sample code. In OOPSLA, 2006. ISBN 1--59593--348--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. A. Solar-Lezama, G. Arnold, L. Tancau, R. Bodík, V. A. Saraswat, and S. A. Seshia. Sketching stencils. In PLDI, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. R. Statman. Intuitionistic propositional logic is polynomial-space complete. Theoretical Computer Science, 9 (1): 67 -- 72, 1979.Google ScholarGoogle ScholarCross RefCross Ref
  25. heorem Prover()}DjinnThe Djinn Theorem Prover. http://www.augustsson.net/Darcs/Djinn/.Google ScholarGoogle Scholar
  26. The Eclipse Foundation. http://www.eclipse.org/.Google ScholarGoogle Scholar
  27. S. Thummalapenta and T. Xie. PARSEWeb: a programmer assistant for reusing open source code on the web. In ASE, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. P. Urzyczyn. Inhabitation in typed lambda-calculi (a syntactic approach). In TLCA, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. J. B. Wells and B. Yakobowski. Graph-based proof counting and enumeration with applications for program fragment synthesis. In LOPSTR, pages 262--277, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Complete completion using types and weights

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      PLDI '13: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation
      June 2013
      546 pages
      ISBN:9781450320146
      DOI:10.1145/2491956
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 48, Issue 6
        PLDI '13
        June 2013
        515 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2499370
        Issue’s Table of Contents

      Copyright © 2013 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 16 June 2013

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      PLDI '13 Paper Acceptance Rate46of267submissions,17%Overall Acceptance Rate406of2,067submissions,20%

      Upcoming Conference

      PLDI '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader