skip to main content
research-article

Efficient divide-and-conquer parsing of practical context-free languages

Authors Info & Claims
Published:25 September 2013Publication History
Skip Abstract Section

Abstract

We present a divide-and-conquer algorithm for parsing context-free languages efficiently. Our algorithm is an instance of Valiant's (1975), who reduced the problem of parsing to matrix multiplications. We show that, while the conquer step of Valiant's is O(n3) in the worst case, it improves to O(logn3), under certain conditions satisfied by many useful inputs. These conditions occur for example in program texts written by humans. The improvement happens because the multiplications involve an overwhelming majority of empty matrices. This result is relevant to modern computing: divide-and-conquer algorithms can be parallelized relatively easily.

References

  1. L. Allison. Lazy Dynamic-Programming can be eager. Information Processing Letters, 43(4):207--212, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. J.-P. Bernardy. Yi: an editor in Haskell for Haskell. In Proc. of the first ACM SIGPLAN symposium on Haskell, pages 61--62. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J.-P. Bernardy. Lazy functional incremental parsing. In Proc. of the 2nd ACM SIGPLAN symposium on Haskell, pages 49--60. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. R. Bird and O. de Moor. Algebra of programming. Prentice-Hall, Inc., 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. N. Chomsky. On certain formal properties of grammars. Information and control, 2(2):137--167, 1959.Google ScholarGoogle ScholarCross RefCross Ref
  6. M. Chytil, M. Crochemore, B. Monien, and W. Rytter. On the parallel recognition of unambiguous context-free languages. Theor. Comp. Sci., 81(2):311--316, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. K. Claessen. Parallel parsing processes. J. Funct. Program., 14(6):741--757, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Cocke. Programming languages and their compilers: Preliminary notes. Courant Institute of Mathematical Sci.s, New York University, 1969. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to algorithms, second ed. MIT press, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Forsberg and A. Ranta. BNFC Quick reference, chapter Appendix A, pages 175--192. College Publications, 2012.Google ScholarGoogle Scholar
  11. R. J. M. Hughes and S. D. Swierstra. Polish parsers, step by step. In Proc. of ICFP 2003, pages 239--248. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. T. Kasami. An efficient recognition and syntax analysis algorithm for context-free languages. Technical report, DTIC Document, 1965.Google ScholarGoogle Scholar
  13. M. Lange and H. Leiß. To CNF or not to CNF? an efficient yet presentable version of the CYK algorithm. Informatica Didactica (8)(2008--2010), 2009.Google ScholarGoogle Scholar
  14. B. O'Sullivan. The Criterion benchmarking library, 2013.Google ScholarGoogle Scholar
  15. W. Rytter and R. Giancarlo. Optimal parallel parsing of bracket languages. Theor. computer science, 53(2):295--306, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. K. Sikkel and A. Nijholt. Parsing of context-free languages, pages 61--100. Springer-Verlag, 1997.Google ScholarGoogle Scholar
  17. V. Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 13:354--356, 1969. 10.1007/BF02165411.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Tomita. Efficient Parsing for Natural Language. Kluwer Adademic Publishers, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. L. Valiant. General context-free recognition in less than cubic time. J. of computer and system sciences, 10(2):308--314, 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. A. Wagner and S. L. Graham. Efficient and flexible incremental parsing. ACM Transactions on Programming Languages and Systems, 20(5): 980--1013, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Younger. Recognition and parsing of context-free languages in time n3. Information and control, 10(2):189--208, 1967.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Efficient divide-and-conquer parsing of practical context-free languages

    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 48, Issue 9
      ICFP '13
      September 2013
      457 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2544174
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
        September 2013
        484 pages
        ISBN:9781450323260
        DOI:10.1145/2500365

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 25 September 2013

      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!