Skip to main content

Parser Combinators for Ambiguous Left-Recursive Grammars

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2008)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4902))

Included in the following conference series:

Abstract

Parser combinators are higher-order functions used to build parsers as executable specifications of grammars. Some existing implementations are only able to handle limited ambiguity, some have exponential time and/or space complexity for ambiguous input, most cannot accommodate left-recursive grammars. This paper describes combinators, implemented in Haskell, which overcome all of these limitations.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aho, A.V., Ullman, J.D.: The Theory of Parsing, Translation, and Compiling, vol. I: Parsing. Prentice-Hall, Englewood Cliffs (1972)

    Google Scholar 

  2. Burge, W.H.: Recursive Programming Techniques. Addison-Wesley, Reading (1975)

    MATH  Google Scholar 

  3. Carroll, J.: Efficiency in large-scale parsing systems – parser comparison (2003), http://informatics.sussex.ac.uk/research/nlp/carroll/elsps.html

  4. Earley, J.: An efficient context-free parsing algorithm. Communications of the ACM 13(2), 94–102 (1970)

    Article  MATH  Google Scholar 

  5. Fairburn, J.: Making form follow function: An exercise in functional programming style. Cambridge Comp. Lab. Technical Report No. 89 (1986)

    Google Scholar 

  6. Ford, B.: Packrat parsing: Simple, powerful, lazy, linear time. In: ICFP, pp. 36–47 (2002)

    Google Scholar 

  7. Frost, R.A.: Realization of natural language interfaces using lazy functional programming. ACM Comp. Surv. 38(4) Article 11 (2006)

    Google Scholar 

  8. Frost, R.A.: Using memoization to achieve polynomial complexity of purely functional executable specifications of non-deterministic top-down parsers. SIGPLAN Notices 29(4), 23–30 (1994)

    Article  Google Scholar 

  9. Frost, R.A., Hafiz, R., Callaghan.: Modular and efficient top-down parsing for ambiguous left-recursive grammars. In: Proc. of the Tenth Int. Conf. on Parsing Technologies, pp. 109–120. ACL Press (2007)

    Google Scholar 

  10. Frost, R.A., Hafiz, R.: A new top-down parsing algorithm to accommodate ambiguity and left recursion in polynomial time. SIGPLAN Notices 42(5), 46–54 (2006)

    Article  Google Scholar 

  11. Hutton, G., Meijer, E.: Monadic parser combinators. J. of Functional Programming 8(4), 437–444 (1995)

    Article  Google Scholar 

  12. Johnson, M.: Squibs and discussions: Memoization in top-down parsing. Computational Linguistics 21(3), 405–417 (1995)

    Google Scholar 

  13. Kuno, S.: The augmented predictive analyzer for context-free languages — its relative efficiency. Communications of the ACM 9(11), 810–823 (1966)

    Article  MATH  Google Scholar 

  14. Lickman, P.: Parsing With Fixed Points. Master’s Th., Oxford (1995)

    Google Scholar 

  15. Nederhof, M.J., Koster, C.H.A.: Top-down parsing for left-recursive grammars. Technical Report 93–10. Research Institute for Declarative Systems, Department of Informatics, Faculty of Mathematics and Informatics, Katholieke Universiteit, Nijmegen (1993)

    Google Scholar 

  16. Norvig, P.: Techniques for automatic memoization with applications to context-free parsing. Computational Linguistics 17(1), 91–98 (1991)

    Google Scholar 

  17. Shiel, B.A.: Observations on context-free parsing. Technical Reports TR 12–76, Center for Research in Computing Technology, Aiken Computational Laboratory, Harvard University (1976)

    Google Scholar 

  18. Tomita, M.: Efficient Parsing for Natural Language: A Fast Algorithm for Practical Systems. Kluwer Academic Publishers, Boston, MA (1986)

    Google Scholar 

  19. Wadler, P.: How to replace failure by a list of successes. In: Jouannaud, J.-P. (ed.) Functional Programming Languages and Computer Architecture. LNCS, vol. 201, pp. 113–128. Springer, Heidelberg (1985)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Paul Hudak David S. Warren

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Frost, R.A., Hafiz, R., Callaghan, P. (2007). Parser Combinators for Ambiguous Left-Recursive Grammars. In: Hudak, P., Warren, D.S. (eds) Practical Aspects of Declarative Languages. PADL 2008. Lecture Notes in Computer Science, vol 4902. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-77442-6_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-77442-6_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-77441-9

  • Online ISBN: 978-3-540-77442-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics