Pushdown Automata and Stack Discipline

Use stack behavior to recognize matching obligations and identify why input order matters to this computational model.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. A stack stores unmatched openings in reverse arrival order
  2. The machine has access only to the top symbol

A stack stores unmatched openings in reverse arrival order

For well-nested parentheses with several bracket types, push the expected closing type for each opening. On a closing symbol require it to equal the top and then pop. The invariant is that the stack lists outstanding closings from the most recent unmatched opening down to the oldest. Accept on end-of-input with no outstanding obligations, rejecting a closer read on an empty or mismatched stack. For strings \(0^n1^n\), push on zeros, pop on ones and use a state to prevent later zeros.

The machine has access only to the top symbol

One stack can track nested obligations but cannot arbitrarily compare two distant positions. Nondeterministic pushdown automata recognize exactly the context-free languages. Deterministic stack machines recognize a subclass. Context-free grammars describe the same general language family declaratively. Context-free pumping can show why matching three consecutive equal counts needs extra power.[1][2]

References

  1. John Hopcroft, Rajeev Motwani and Jeffrey Ullman, Context-Free Grammars and Languages ↩
  2. Michael Sipser, Introduction to the Theory of Computation ↩