CS 15-212: Fundamental Structures of Computer Science II

Lecture 9: Regular Expressions

Regular expressions--and their underlying finite-state automata--are useful in many different applications, and are central to text processing languages and tools such as awk, Perl, emacs and grep. After considering the basic idea of a nondeterministic finite state machine, we introduce regular expressions and discuss the surprising equivalence between the two.

Regular expression pattern matching has a simple and elegant implementation in SML using continuation passing. This use of continuations naturally captures the notion of nondeterminism in the equivalent machine, but allows us to dispense with an explicit definition of "state."

Key Concepts

Sample Code

On-line Notes


[ home | schedule | language | assignments | handouts ]

John Lafferty
lafferty@cs.cmu.edu