Hostname: page-component-848d4c4894-ttngx Total loading time: 0 Render date: 2024-06-03T06:12:39.474Z Has data issue: false hasContentIssue false

When Maybe is not good enough

Published online by Cambridge University Press:  10 September 2012

MICHAEL SPIVEY*
Affiliation:
Department of Computer Science, University of Oxford, Oxford, UK (e-mail: mike@cs.ox.ac.uk)
Rights & Permissions [Opens in a new window]

Extract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Many variations upon the theme of parser combinators have been proposed, too many to list here, but the main idea is simple: A parser for phrases of type α is a function that takes an input string and produces results (x, rest), where x is a value of type α, and rest is the remainder of the input after the phrase with value x has been consumed. The results are often arranged into a list, because this allows a parser to signal failure with the empty list of results, an unambiguous success with one result, or multiple possibilities with a longer ‘list of successes’.

Type
Functional Pearl
Copyright
Copyright © Cambridge University Press 2012

References

Knuth, D. E. (1971) Top-down syntax analysis. Acta Inform. 1, 79110. Reprinted as Chapter 14 of Knuth (2003).CrossRefGoogle Scholar
Knuth, D. E. (2003) Selected Papers on Computer Languages. Palo Alto, CA: CSLI.Google Scholar
McBride, C. & Paterson, R. (2008) Applicative programming with effects. J. Funct. Program. 18 (1), 113.CrossRefGoogle Scholar
Sipser, M. F. (2005) Introduction to the Theory of Computation. 2nd ed.Boston, MA: Course Technology.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.