15-150: Principles of Functional Programming

Lecture 15: Regular Expressions continued (Combinators)

Today, we discussed rewriting our regular expression matcher using combinators. Combinators help us separate the processing of the regular expression from the actual character matching and continuation-based control flow. This separation facilitates staging: The regular expression pattern matching is in one stage, the character and continuation functions are in another. One can thus produce a matcher for a regular expression without ever seeing any input or continuations.

For a review of staging see Lecture 11.

For the unstaged regular expression matcher see Lecture 14.

Sample Code

Slides from Lecture