Chapter 2: Context-Free Languages

For Your Enjoyment

Chapter 2.2, Pushdown Automata

Theorem 2.20

A language is context free if and only if some pushdown automaton recognizes it.

CFG → PDA Construction

Step One: Create a 3-State PDA

Step Two: Add States to Push One Symbol at a Time

For example, instead of qstart transitioning to qloop directly on rule ε, ε → S$, it transitions to an intermediate state on rule ε, ε → $ and the intermediate state transitions to qloop on rule ε, ε → S.

Active Learning Problem

Convert the following CFG to a PDA using the procedure above.

  E → E + T | T
  T → T * F | F
  F → (E) | a

PDA → CFG Construction

Preliminary Construction

Convert the original PDA to a PDA with the following characteristics.

Active Learning

Convert the following transition δ(r, 0, 0) → (s, 1) to meet the criteria above.


Construct G from P = (Q, Σ, Γ, δ, q0, {qaccept}). The variables of G are {Apq | p, q ∈ Q} and the start variable is Aq0, qaccept.

Active Learning

In-Class Notes

Valid XHTML 1.0!