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.
- A. Bove, P. Dybjer, and U. Norell. A brief overview of Agda - a functional language with dependent types. In TPHOLs, 2009. Google ScholarDigital Library
- 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 ScholarDigital Library
- M. Bruch, M. Monperrus, and M. Mezini. Learning from examples to improve code completion systems. In ESEC/SIGSOFT FSE, pages 213--222, 2009. Google ScholarDigital Library
- S. Chatterjee, S. Juvekar, and K. Sen. SNIFF: A search engine for java using free-form queries. FASE'09, pages 385--400, 2009. Google ScholarDigital Library
- D. Delahaye. Information retrieval in a Coq proof library using type isomorphisms. In TYPES, pages 131--147, 1999. Google ScholarDigital Library
- G. Dowek. Higher-order unification and matching. Handbook of automated reasoning, II: 1009--1062, 2001. Google ScholarDigital Library
- G. Dowek and Y. Jiang. Enumerating proofs of positive formulae. Comput. J., 52 (7): 799--807, Oct. 2009. ISSN 0010--4620. Google ScholarDigital Library
- Eclipse Code Recommenders. http://www.eclipse.org/recommenders/.Google Scholar
- M. Ferrari, C. Fiorentini, and G. Fiorino. fCube: An efficient prover for intuitionistic propositional logic. In LPAR (Yogyakarta), 2010. Google ScholarDigital Library
- 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 ScholarDigital Library
- T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. On complete completion using types and weights. Technical report, EPFL, December 2012.Google Scholar
- Hayoo! API Search. http://holumbus.fh-wedel.de/hayoo/hayoo.html.Google Scholar
- R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. ICSE'05, pages 117--125, 2005. Google ScholarDigital Library
- Hoogle API Search. http://www.haskell.org/hoogle/.Google Scholar
- IntelliJ IDEA website, 2011. URL http://www.jetbrains.com/idea/.Google Scholar
- I. Kuraj. Interactive code generation. Master's thesis, EPFL, February 2013.Google Scholar
- Z. Luo. Coercions in a polymorphic type system. phMathematical Structures in Computer Science, 18 (4): 729--751, 2008. Google ScholarDigital Library
- D. Mandelin, L. Xu, R. Bodík, and D. Kimelman. Jungloid mining: helping to navigate the api jungle. In phPLDI, 2005. Google ScholarDigital Library
- S. McLaughlin and F. Pfenning. Efficient intuitionistic theorem proving with the polarized inverse method. In CADE, 2009. Google ScholarDigital Library
- D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, pages 275--286, 2012. Google ScholarDigital Library
- J. C. Reynolds. Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation, pages 211--258, 1980. Google ScholarDigital Library
- N. Sahavechaphan and K. Claypool. Xsnippet: mining for sample code. In OOPSLA, 2006. ISBN 1--59593--348--4. Google ScholarDigital Library
- A. Solar-Lezama, G. Arnold, L. Tancau, R. Bodík, V. A. Saraswat, and S. A. Seshia. Sketching stencils. In PLDI, 2007. Google ScholarDigital Library
- R. Statman. Intuitionistic propositional logic is polynomial-space complete. Theoretical Computer Science, 9 (1): 67 -- 72, 1979.Google ScholarCross Ref
- heorem Prover()}DjinnThe Djinn Theorem Prover. http://www.augustsson.net/Darcs/Djinn/.Google Scholar
- The Eclipse Foundation. http://www.eclipse.org/.Google Scholar
- S. Thummalapenta and T. Xie. PARSEWeb: a programmer assistant for reusing open source code on the web. In ASE, 2007. Google ScholarDigital Library
- P. Urzyczyn. Inhabitation in typed lambda-calculi (a syntactic approach). In TLCA, 1997. Google ScholarDigital Library
- 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 ScholarDigital Library
Index Terms
- Complete completion using types and weights
Recommendations
Type-directed completion of partial expressions
PLDI '12: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and ImplementationModern programming frameworks provide enormous libraries arranged in complex structures, so much so that a large part of modern programming is searching for APIs that surely exist" somewhere in an unfamiliar part of the framework. We present a novel way ...
Complete completion using types and weights
PLDI '13Developing 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 ...
Type-directed completion of partial expressions
PLDI '12Modern programming frameworks provide enormous libraries arranged in complex structures, so much so that a large part of modern programming is searching for APIs that surely exist" somewhere in an unfamiliar part of the framework. We present a novel way ...
Comments