skip to main content
research-article

Synthesizing Java expressions from free-form queries

Published:23 October 2015Publication History
Skip Abstract Section

Abstract

We present a new code assistance tool for integrated development environments. Our system accepts as input free-form queries containing a mixture of English and Java, and produces Java code expressions that take the query into account and respect syntax, types, and scoping rules of Java, as well as statistical usage patterns. In contrast to solutions based on code search, the results returned by our tool need not directly correspond to any previously seen code fragment. As part of our system we have constructed a probabilistic context free grammar for Java constructs and library invocations, as well as an algorithm that uses a customized natural language processing tool chain to extract information from free-form text queries. We present the results on a number of examples showing that our technique (1) often produces the expected code fragments, (2) tolerates much of the flexibility of natural language, and (3) can repair incorrect Java expressions that use, for example, the wrong syntax or missing arguments.

References

  1. M. Allamanis and S. Charles. Mining Source Code Repositories at Massive Scale using Language Modeling. In Conf. Mining Software Repositories. IEEE, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. AnyCode Source Code. https: //github.com/tihomirg/nlpcoder/tree/noola, 2015.Google ScholarGoogle Scholar
  3. BitBucket. BitBucket repository hosting service, https://bitbucket.org/, 2015.Google ScholarGoogle Scholar
  4. 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
  5. R. Burkard, M. Dell’Amico, and S. Martello. Assignment Problems. Society for Industrial and Applied Math., 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Chatterjee, S. Juvekar, and K. Sen. SNIFF: A search engine for java using free-form queries. In FASE, pages 385–400, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Cozzie and S. T. King. Macho: Writing programs with natural language and examples. Technical report, University of Illinois at Urbana-Champaign, 2012.Google ScholarGoogle Scholar
  8. M.-C. de Marneffe, B. MacCartney, and C. D. Manning. Generating typed dependency parses from phrase structure parses. In LREC, pages 449–454, 2006.Google ScholarGoogle Scholar
  9. Eclipse Code Recommenders. http://www.eclipse.org/recommenders/, 2015.Google ScholarGoogle Scholar
  10. EclipseJDT. EclipseJDT, http://www.eclipse.org/jdt/, 2015.Google ScholarGoogle Scholar
  11. C. Fellbaum. WordNet: An Electronic Lexical Database. Bradford Books, 1998.Google ScholarGoogle ScholarCross RefCross Ref
  12. J. Galenson, P. Reames, R. Bod´ık, B. Hartmann, and K. Sen. Codehint: Dynamic and interactive synthesis of code snippets. In ICSE, pages 653–663, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. GitHub. GitHub repository hosting service, https://github.com/, 2015.Google ScholarGoogle Scholar
  14. T. Gvero and V. Kuncak. Interactive synthesis using free-form queries. In International Conference on Software Engineering, Demo Papers (ICSE Demo), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. T. Gvero, V. Kuncak, and R. Piskac. Interactive synthesis of code snippets. In Computer Aided Verification (CAV) Tool Demo, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, pages 27–38, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Harman, Y. Jia, and W. B. Langdon. Babel pidgin: SBSE can grow and graft entirely new functionality into a real world system. In SSBSE Challenge Track, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  18. R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In ICSE, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Jurafsky and J. H. Martin. Speech and Language Processing. Prentice Hall, 2 edition, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. H. W. Kuhn. The Hungarian method for the assignment problem. Naval Research Logistics Quart., 2:83–97, 1955.Google ScholarGoogle ScholarCross RefCross Ref
  21. V. Le, S. Gulwani, and Z. Su. Smartsynth: Synthesizing smartphone automation scripts from natural language. In MobiSys, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. Little and R. C. Miller. Keyword programming in Java. In ASE, pages 84–93, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. H. Liu and H. Lieberman. Metafor: Visualizing stories as code. In IUI, pages 305–307, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. C. D. Manning, M. Surdeanu, J. Bauer, J. Finkel, S. J. Bethard, and D. McClosky. The Stanford CoreNLP natural language processing toolkit. In ACL, pages 55–60, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  25. A. Mishne, S. Shoham, and E. Yahav. Typestate-based semantic code search over partial programs. In OOPSLA, pages 997–1016, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Price, E. Riloff, J. L. Zachary, and B. Harvey. NaturalJava: A natural language interface for programming in Java. In IUI, pages 207–211, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. V. Raychev, M. T. Vechev, and E. Yahav. Code completion with statistical language models. In PLDI, page 44, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. S. P. Reiss. Semantics-based code search. In ICSE, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. N. Sahavechaphan and K. Claypool. Xsnippet: mining for sample code. In OOPSLA, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. SourceForge. SourceForge source code repository, http://sourceforge.net/, 2015.Google ScholarGoogle Scholar
  31. K. T. Stolee, S. Elbaum, and D. Dobos. Solving the search for source code. ACM TOSEM, 23:26:1–26:45, June 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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
  33. K. Toutanova, D. Klein, C. D. Manning, and Y. Singer. Feature-rich part-of-speech tagging with a cyclic dependency network. In HLT-NAACL, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Synthesizing Java expressions from free-form queries

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 50, Issue 10
      OOPSLA '15
      October 2015
      953 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2858965
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
        October 2015
        953 pages
        ISBN:9781450336895
        DOI:10.1145/2814270

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 23 October 2015

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!