Combinator Parsing: A Short Tutorial

  • Authors:
  • S. Doaitse Swierstra

  • Affiliations:
  • Center for Software Technology, Utrecht University, The Netherlands

  • Venue:
  • Language Engineering and Rigorous Software Development
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

There are numerous ways to implement a parser for a given syntax; using parser combinators is a powerful approach to parsing which derives much of its power and expressiveness from the type system and semantics of the host programming language. This tutorial begins with the construction of a small library of parsing combinators. This library introduces the basics of combinator parsing and, more generally, demonstrates how domain specific embedded languages are able to leverage the facilities of the host language. After having constructed our small combinator library, we investigate some shortcomings of the naïve implementation introduced in the first part, and incrementally develop an implementation without these problems. Finally we discuss some further extensions of the presented library and compare our approach with similar libraries.