Skip to content
Go back

Regular Expressions, Part 2

Published:  at  03:07 PM

Reworking my earlier notes on Chapter 3: Scanning in Thain 2e (2020); and the classic Dragon Book 2e (2006) by Aho, Lam, Sethi, and Ullman.


I. Simplified take


II. Complete Hierarchy

Level 0 - Alphabet

Level 1 - Symbols

Level 2 - Strings

  1. A string (or word) is a finite sequence of symbols drawn from alphabet Σ.
  2. Examples: a; abba; the empty string with length = 0, denoted with lower-case epsilon 𝜖.
  3. Σ* (Sigma Star) is the formal notation for “the set of all strings over alphabet Σ”.
    • The main operation that generates Σ* is repeated concatenation.
    • Σ* includes all those strings plus the empty string 𝜖.
  4. Key facts about empty string 𝜖:
    • 𝜖 is a string.
    • 𝜖 is an element of Σ* (pronounced “Sigma Star”).
    • 𝜖 is not a set.

Level 3 - Languages

Critical reminder about Levels 0-3

Level 4 - Regex


III. What Level are Operators?


A. Operators on Strings

1. Concatenation on Strings

2. Length on Strings

3. Predicates on Strings


B. Operators on Languages

1. Union on Languages

2. Concatenation on Languages

3. Kleene Star on Languages

4. Kleene Plus on Languages


C. One sentence summary on Operators


IV. In Brief