skip to main content
research-article
Open Access
Artifacts Available / v1.1

LooPy: interactive program synthesis with control structures

Published:15 October 2021Publication History
Skip Abstract Section

Abstract

One vision for program synthesis, and specifically for programming by example (PBE), is an interactive programmer's assistant, integrated into the development environment. To make program synthesis practical for interactive use, prior work on Small-Step Live PBE has proposed to limit the scope of synthesis to small code snippets, and enable the users to provide local specifications for those snippets. This paradigm, however, does not work well in the presence of loops. We present LooPy, a synthesizer integrated into a live programming environment, which extends Small-Step Live PBE to work inside loops and scales it up to synthesize larger code snippets, while remaining fast enough for interactive use. To allow users to effectively provide examples at various loop iterations, even when the loop body is incomplete, LooPy makes use of live execution, a technique that leverages the programmer as an oracle to step over incomplete parts of the loop. To enable synthesis of loop bodies at interactive speeds, LooPy introduces Intermediate State Graph, a new data structure, which compactly represents a large space of code snippets composed of multiple assignment statements and conditionals. We evaluate LooPy empirically using benchmarks from competitive programming and previous synthesizers, and show that it can solve a wide variety of synthesis tasks at interactive speeds. We also perform a small qualitative user study which shows that LooPy's block-level specifications are easy for programmers to provide.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video of our talk at OOPSLA 2021 on the paper "LooPy: Interactive Program Synthesis with Control Structures". It introduces LooPy, a tool for Interactive Program Synthesis with Control Structures, starting with a review of background work, describing the two main contributions in Loopy (Live Execution, and the Intermediate State Graph) and ending with some of the evaluations.

References

  1. Aws Albarghouthi, Sumit Gulwani, and Zachary Kincaid. 2013. Recursive program synthesis. In International conference on computer aided verification. 934–950. https://doi.org/10.1007/978-3-642-39799-8_67 Google ScholarGoogle ScholarCross RefCross Ref
  2. Rajeev Alur, Pavol Cerný, and Arjun Radhakrishna. 2015. Synthesis Through Unification. In Computer Aided Verification - 27th International Conference, CAV 2015, San Francisco, CA, USA, July 18-24, 2015, Proceedings, Part II. 163–179.Google ScholarGoogle Scholar
  3. Rajeev Alur, Arjun Radhakrishna, and Abhishek Udupa. 2017. Scaling Enumerative Program Synthesis via Divide and Conquer. In Tools and Algorithms for the Construction and Analysis of Systems - 23rd International Conference, TACAS 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings, Part I. 319–336. https://doi.org/10.1007/978-3-662-54577-5_18 Google ScholarGoogle Scholar
  4. Shraddha Barke, Hila Peleg, and Nadia Polikarpova. 2020. Just-in-Time Learning for Bottom-up Enumerative Synthesis. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 227, Nov., 29 pages. https://doi.org/10.1145/3428295 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Shaon Barman, Rastislav Bodik, Satish Chandra, Emina Torlak, Arka Bhattacharya, and David Culler. 2015. Toward Tool Support for Interactive Synthesis. In 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!) (Onward! 2015). Association for Computing Machinery, New York, NY, USA. 121–136. isbn:9781450336888 https://doi.org/10.1145/2814228.2814235 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Rohan Bavishi, Caroline Lemieux, Roy Fox, Koushik Sen, and Ion Stoica. 2019. AutoPandas: Neural-Backed Generators for Program Synthesis. Proc. ACM Program. Lang., 3, OOPSLA (2019), Article 168, Oct., 27 pages. https://doi.org/10.1145/3360594 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Sarah E. Chasins, Maria Mueller, and Rastislav Bodik. 2018. Rousillon: Scraping Distributed Hierarchical Web Data. In Proceedings of the 31st Annual ACM Symposium on User Interface Software and Technology (UIST ’18). Association for Computing Machinery, New York, NY, USA. 963–975. isbn:9781450359481 https://doi.org/10.1145/3242587.3242661 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ian Drosos, Titus Barik, Philip J. Guo, Robert DeLine, and Sumit Gulwani. 2020. Wrex: A Unified Programming-by-Example Interaction for Synthesizing Readable Code for Data Scientists. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems (CHI ’20). Association for Computing Machinery, New York, NY, USA. 1–12. isbn:9781450367080 https://doi.org/10.1145/3313831.3376442 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Yu Feng, Ruben Martins, Osbert Bastani, and Isil Dillig. 2018. Program Synthesis Using Conflict-Driven Learning. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). Association for Computing Machinery, New York, NY, USA. 420–435. isbn:9781450356985 https://doi.org/10.1145/3192366.3192382 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Yu Feng, Ruben Martins, Yuepeng Wang, Isil Dillig, and Thomas W. Reps. 2017. Component-Based Synthesis for Complex APIs. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). Association for Computing Machinery, New York, NY, USA. 599–612. isbn:9781450346603 https://doi.org/10.1145/3009837.3009851 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Kasra Ferdowsifard, Allen Ordookhanians, Hila Peleg, Sorin Lerner, and Nadia Polikarpova. 2020. Small-Step Live Programming by Example. In Proceedings of the 33rd Annual ACM Symposium on User Interface Software and Technology (UIST ’20). Association for Computing Machinery, New York, NY, USA. 614–626. isbn:978-1-4503-7514-6 https://doi.org/10.1145/3379337.3415869 event-place: Virtual Event, USA Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. John K. Feser, Swarat Chaudhuri, and Isil Dillig. 2015. Synthesizing Data Structure Transformations from Input-Output Examples. SIGPLAN Not., 50, 6 (2015), June, 229–239. issn:0362-1340 https://doi.org/10.1145/2813885.2737977 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Joel Galenson, Philip Reames, Rastislav Bodik, Björn Hartmann, and Koushik Sen. 2014. CodeHint: Dynamic and Interactive Synthesis of Code Snippets. In Proceedings of the 36th International Conference on Software Engineering (ICSE 2014). Association for Computing Machinery, New York, NY, USA. 653–663. isbn:9781450327565 https://doi.org/10.1145/2568225.2568250 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Sumit Gulwani, Susmit Jha, Ashish Tiwari, and Ramarathnam Venkatesan. 2011. Synthesis of Loop-Free Programs. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’11). Association for Computing Machinery, New York, NY, USA. 62–73. isbn:9781450306638 https://doi.org/10.1145/1993498.1993506 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Tihomir Gvero, Viktor Kuncak, Ivan Kuraj, and Ruzica Piskac. 2013. Complete Completion Using Types and Weights. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). Association for Computing Machinery, New York, NY, USA. 27–38. isbn:9781450320146 https://doi.org/10.1145/2491956.2462192 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Michael B. James, Zheng Guo, Ziteng Wang, Shivani Doshi, Hila Peleg, Ranjit Jhala, and Nadia Polikarpova. 2020. Digging for Fold: Synthesis-Aided API Discovery for Haskell. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 205, Nov., 27 pages. https://doi.org/10.1145/3428273 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Etienne Kneuss, Ivan Kuraj, Viktor Kuncak, and Philippe Suter. 2013. Synthesis modulo Recursive Functions. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’13). Association for Computing Machinery, New York, NY, USA. 407–426. isbn:9781450323741 https://doi.org/10.1145/2509136.2509555 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. K. Rustan M. Leino and Aleksandar Milicevic. 2012. Program Extrapolation with Jennisys. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’12). Association for Computing Machinery, New York, NY, USA. 411–430. isbn:9781450315616 https://doi.org/10.1145/2384616.2384646 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Sorin Lerner. 2020. Projection Boxes: On-the-fly Reconfigurable Visualization for Live Programming. CHI ’20. ACM. isbn:78-1-4503-6708-0/20/04 https://doi.org/10.1145/3313831.3376494 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Justin Lubin, Nick Collins, Cyrus Omar, and Ravi Chugh. 2020. Program Sketching with Live Bidirectional Evaluation. Proc. ACM Program. Lang., 4, ICFP (2020), Article 109, Aug., 29 pages. https://doi.org/10.1145/3408991 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. David Mandelin, Lin Xu, Rastislav Bodík, and Doug Kimelman. 2005. Jungloid Mining: Helping to Navigate the API Jungle. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’05). Association for Computing Machinery, New York, NY, USA. 48–61. isbn:1595930566 https://doi.org/10.1145/1065010.1065018 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Gayle Laakmann McDowell. 2015. Cracking the coding interview: 189 programming questions and solutions; 6th ed.. CareerCup, Palo Alto, CA. https://cds.cern.ch/record/2669252Google ScholarGoogle Scholar
  23. Cyrus Omar, Ian Voysey, Ravi Chugh, and Matthew A. Hammer. 2019. Live Functional Programming with Typed Holes. Proc. ACM Program. Lang., 3, POPL (2019), Article 14, Jan., 32 pages. https://doi.org/10.1145/3290327 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Peter-Michael Osera and Steve Zdancewic. 2015. Type-and-Example-Directed Program Synthesis. SIGPLAN Not., 50, 6 (2015), June, 619–630. issn:0362-1340 https://doi.org/10.1145/2813885.2738007 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Hila Peleg, Roi Gabay, Shachar Itzhaky, and Eran Yahav. 2020. Programming with a Read-Eval-Synth Loop. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 159, Nov., 30 pages. https://doi.org/10.1145/3428227 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Hila Peleg and Nadia Polikarpova. 2020. Perfect Is the Enemy of Good: Best-Effort Program Synthesis. In 34th European Conference on Object-Oriented Programming (ECOOP 2020), Robert Hirschfeld and Tobias Pape (Eds.) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 166). Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl, Germany. 2:1–2:30. isbn:978-3-95977-154-2 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ECOOP.2020.2 Google ScholarGoogle ScholarCross RefCross Ref
  27. Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program Synthesis from Polymorphic Refinement Types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). Association for Computing Machinery, New York, NY, USA. 522–538. isbn:9781450342612 https://doi.org/10.1145/2908080.2908093 Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Kensen Shi, David Bieber, and Rishabh Singh. 2020. TF-Coder: Program Synthesis for Tensor Manipulations. arXiv preprint arXiv:2003.09040.Google ScholarGoogle Scholar
  29. Kensen Shi, Jacob Steinhardt, and Percy Liang. 2019. FrAngel: Component-Based Synthesis with Control Structures. Proc. ACM Program. Lang., 3, POPL (2019), Article 73, Jan., 29 pages. https://doi.org/10.1145/3290386 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Calvin Smith and Aws Albarghouthi. 2016. MapReduce Program Synthesis. SIGPLAN Not., 51, 6 (2016), June, 326–340. issn:0362-1340 https://doi.org/10.1145/2980983.2908102 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Sunbeom So and Hakjoo Oh. 2017. Synthesizing imperative programs from examples guided by static analysis. In International Static Analysis Symposium. 364–381. https://doi.org/10.1007/978-3-319-66706-5_18 Google ScholarGoogle ScholarCross RefCross Ref
  32. Abhishek Udupa, Arun Raghavan, Jyotirmoy V. Deshmukh, Sela Mador-Haim, Milo M.K. Martin, and Rajeev Alur. 2013. TRANSIT: Specifying Protocols with Concolic Snippets. SIGPLAN Not., 48, 6 (2013), June, 287–296. issn:0362-1340 https://doi.org/10.1145/2499370.2462174 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Chenglong Wang, Alvin Cheung, and Rastislav Bodik. 2017. Synthesizing Highly Expressive SQL Queries from Input-Output Examples. SIGPLAN Not., 52, 6 (2017), June, 452–466. issn:0362-1340 https://doi.org/10.1145/3140587.3062365 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Zijiang Yang, Jinru Hua, Kaiyuan Wang, and Sarfraz Khurshid. 2018. EdSynth: Synthesizing API sequences with conditionals and loops. In 2018 IEEE 11th International Conference on Software Testing, Verification and Validation (ICST). 161–171. https://doi.org/10.1109/ICST.2018.00025 Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. LooPy: interactive program synthesis with control structures

        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 Proceedings of the ACM on Programming Languages
          Proceedings of the ACM on Programming Languages  Volume 5, Issue OOPSLA
          October 2021
          2001 pages
          EISSN:2475-1421
          DOI:10.1145/3492349
          Issue’s Table of Contents

          Copyright © 2021 Owner/Author

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 15 October 2021
          Published in pacmpl Volume 5, Issue OOPSLA

          Permissions

          Request permissions about this article.

          Request Permissions

          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!