skip to main content
research-article

Interactive parser synthesis by example

Published:03 June 2015Publication History
Skip Abstract Section

Abstract

Despite decades of research on parsing, the construction of parsers remains a painstaking, manual process prone to subtle bugs and pitfalls. We present a programming-by-example framework called Parsify that is able to synthesize a parser from input/output examples. The user does not write a single line of code. To achieve this, Parsify provides: (a) an iterative algorithm for synthesizing and refining a grammar one example at a time, (b) an interface that provides immediate visual feedback in response to changes in the grammar being refined, and (c) a graphical mechanism for specifying example parse trees using only textual selections. We empirically demonstrate the viability of our approach by using Parsify to construct parsers for source code drawn from Verilog, SQL, Apache, and Tiger.

References

  1. A. V. Aho and J. D. Ullman. The Theory of Parsing, Translation, and Compiling. Prentice-Hall, 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. Angluin. Inference of reversible languages. J. ACM, 29(3), 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. D. Angluin. Learning regular sets from queries and counterexamples. Information and Computation, 75(2), 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. W. Appel. Modern Compiler Implementation in ML: Basic Techniques. Cambridge University Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. F. Arlitt and C. L. Williamson. Web server workload characterization: The search for invariants. In SIGMETRICS, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. census-postgres, 2014. URL https://github.com/leehach/ census-postgres.Google ScholarGoogle Scholar
  7. A. Cypher, editor. Watch What I Do – Programming by Demonstration. MIT Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. Daly, M. F. Fernández, K. Fisher, Y. Mandelbaum, and D. Walker. LAUNCHPADS: A system for processing ad hoc data. In PLAN-X, 2006.Google ScholarGoogle Scholar
  9. A. Dubey, S. Aggarwal, and P. Jalote. A technique for extracting keyword based rules from a set of programs. In CSMR, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K. Fisher, D. Walker, K. Q. Zhu, and P. White. From dirt to shovels: Fully automatic tool generation from ad hoc data. In POPL, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. B. Ford. Parsing expression grammars: A recognition-based syntactic foundation. In POPL, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. GNU Bison manual. GNU Software Foundation. URL http: //www.gnu.org/software/bison/manual/.Google ScholarGoogle Scholar
  13. R. Grimm. Better extensibility through modular syntax. In PLDI, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Grune and C. J. H. Jacobs. Parsing Techniques: A Practical Guide. Ellis Horwood, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. Gulwani. Automating string processing in spreadsheets using inputoutput examples. In POPL, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Gulwani. Synthesis from examples: Interaction models and algorithms. In SYNASC, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. W. R. Harris and S. Gulwani. Spreadsheet table transformations from examples. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. P. Hart, N. Nilsson, and B. Raphael. A formal basis for the heuristic determination of minimum cost paths. Systems Science and Cybernetics, IEEE Transactions on, 4(2), 1968.Google ScholarGoogle ScholarCross RefCross Ref
  19. instaparse, 2014. URL https://github.com/Engelberg/ instaparse.Google ScholarGoogle Scholar
  20. P. Klint and E. Visser. Using filters for the disambiguation of contextfree grammars. In ASMICS, 1994.Google ScholarGoogle Scholar
  21. P. Klint, R. Lämmel, and C. Verhoef. Toward an engineering discipline for grammarware. ACM TOSEM, 14(3), 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. T. Lau, S. A. Wolfman, P. Domingos, and D. S. Weld. Programming by demonstration using version space algebra. Mach. Learn., 53(1-2), 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. V. Le and S. Gulwani. FlashExtract: A framework for data extraction by examples. In PLDI, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. L. Lee. Learning of context-free languages: A survey of the literature. Technical Report TR-12-96, Harvard University, 1996.Google ScholarGoogle Scholar
  25. T. Lei, F. Long, R. Barzilay, and M. C. Rinard. From natural language specifications to program input parsers. In ACL, 2013.Google ScholarGoogle Scholar
  26. S. McPeak and G. Necula. Elkhound: A fast, practical GLR parser generator. In CC, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  27. M. Mernik, G. Gerliˇc, V. Žumer, and B. R. Bryant. Can a parser be generated from examples? In SAC, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Might and D. Darais. Yacc is dead. CoRR, abs/1010.5023, 2010.Google ScholarGoogle Scholar
  29. R. C. Miller and B. A. Myers. Lightweight structured text processing. In USENIX ATC, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. MonitorWare. Apache (Unix) log samples, 2004. URL http: //www.monitorware.com/en/logsamples/apache.php.Google ScholarGoogle Scholar
  31. R. C. Moore. Removing left recursion from context-free grammars. In NAACL, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. T. Parr and K. Fisher. LL(*): The foundation of the antlr parser generator. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Y. Sakakibara. Efficient learning of context-free grammars from positive structural examples. Information and Computation, 97(1), 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. E. Scott and A. Johnstone. GLL parsing. ENTCS, 253(7), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. R. Singh and S. Gulwani. Synthesizing number transformations from input-output examples. In CAV, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. Thorup. Disambiguating grammars by exclusion of sub-parse trees. Acta Informatica, 33(5), 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. M. Tomita. Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. E. Vidal. Grammatical inference: An introductory survey. In Grammatical Inference and Applications, LNCS. 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. K. Yessenov, S. Tulsiani, A. Menon, R. C. Miller, S. Gulwani, B. Lampson, and A. Kalai. A colorful approach to text processing by example. In UIST, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Interactive parser synthesis by example

      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 6
        PLDI '15
        June 2015
        630 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2813885
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          PLDI '15: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2015
          630 pages
          ISBN:9781450334686
          DOI:10.1145/2737924

        Copyright © 2015 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 3 June 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!