15-150: Principles of Functional Programming

Lecture 15: Regular Expression Matching with Combinators

Today we finish up the proof of correctness from last time. We break the proof into three parts: termination, soundness, and completeness. Please look at the lecture notes from last time for the full proof. We only do a small part of it in lecture.

Next, we discuss rewriting our regular expression matcher using combinators.

We use staging. The regular expression pattern matching is in one stage, the character and continuation functions are in another.

For a review of staging see Lecture 11.

For the unstaged regular expression matcher see Lecture 14.

Sample Code

See Section 3 (on Kleene Algebra Homomorphisms) of these notes from last time.