Nepedia
Back to Discover
Fluent Reader
🔢

Pushdown automaton

math Maturity 11-13 Next article →

A pushdown automaton is a special kind of machine used in computer science.

Pushdown-overview
Pushdown-overview

Scientists use these machines to study what can be computed. This machine is more powerful than a simple finite-state machine. A finite-state machine only looks at the current input and its current state. It cannot remember what happened before because it has no extra memory. A pushdown automaton is different because it uses a tool called a stack. This stack acts like a memory for the machine to use.

Pushdown-step
Pushdown-step

A stack works much like a pile of trays in a cafeteria. You can only reach the tray at the very top. To add a new item, you perform a pushdown action to put it on top. To remove an item, you pop the top item off. This machine reads a string of symbols from left to right. At each step, it looks at the input symbol and its current state. It also looks at the symbol sitting on top of the stack. Based on these three things, the machine decides its next move. It can change its state, push a new symbol, or pop a symbol.

Pushdown-step
Pushdown-step

There are two main ways these machines can behave. A deterministic pushdown automaton, or DPDA, has only one possible move for every situation. This makes it very predictable and useful for designing parsers. A nondeterministic pushdown automaton can have several different possible moves at once. In this case, the machine might follow many different paths. If even one of those paths leads to a successful result, the machine accepts the input. This ability allows it to recognize all context-free languages.

Pda-example
Pda-example

These machines are great at solving puzzles called context-free languages.

Pda-steps
Pda-steps

A machine can decide if a puzzle is correct in two ways. It can reach a specific final state after reading everything. Or, it can accept by emptying its stack completely. There is a special rule that says these two ways are actually equivalent. This means you can build a machine that uses one way to do the job of the other. This is a helpful fact for mathematicians working with these systems.

We can also compare these machines to even more powerful tools. A Turing machine is much stronger than a pushdown automaton. A Turing machine can move back and forth on its memory and change things. A pushdown automaton is weaker because popping an item removes that data forever. However, if you give a pushdown automaton two stacks, it becomes just as powerful as a Turing machine. By using two stacks, the machine can save the data it would otherwise lose. This shows how adding just one more tool can change everything.

447 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (4)
File:Pushdown-overview.svg
Pushdown-overview.svg
File:Pushdown-step.svg
Pushdown-step.svg
File:Pda-example.svg
Pda-example.svg
File:Pda-steps.svg
Pda-steps.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.