15-150: Principles of Functional Programming

Lecture 15: Regular Expressions continued (Proof and Combinators)

Today we mainly discussed the proof of correctness for our regular expression matcher from the previous lecture. We broke the proof into three parts: termination, soundness, and completeness. Please look at the lecture notes from last time for the full proof. We only did a small part of it in lecture.

At the end of lecture, we briefly discussed a version of the regular expression matcher based on 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

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