Hostname: page-component-6766d58669-nqrmd Total loading time: 0 Render date: 2026-05-14T20:12:47.348Z Has data issue: false hasContentIssue false

Combinators for parsing expressions

Published online by Cambridge University Press:  07 November 2008

Steve Hill
Affiliation:
University of Kent, Canterbury, UK
Rights & Permissions [Opens in a new window]

Abstract

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.

This paper describes a scheme for constructing parsers based on the top-down combinator approach. In particular, it describes a set of combinators for parsing expressions described by ambiguous grammars with precedence and associativity rules. The new combinators embody the mechanical grammar manipulations typically employed to remove left-recursion and hence help to avoid the possibility of a non-terminating parser. A number of approaches to the problem are described—the most elegant and efficient method is based on continuation passing. As a practical demonstration, a parser for the expression part of the C programming language is presented. The expression combinators are general, and may be constructed from any suitable set of top-down combinators. A comparison with parser generators shows that the combinator approach is most applicable for rapid development.

Information

Type
Articles
Copyright
Copyright © Cambridge University Press 1996
Submit a response

Discussions

No Discussions have been published for this article.