Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Pushdown automaton?

Dikenal juga sebagai: stack alphabet

Definition 23.12 University Computer Science — Year 2 · Bab 23 — Context-Free Grammars and Pushdown Automata

A pushdown automaton (PDA) is (Q,Σ,Γ,Δ,q0,Z0,F)(Q, \Sigma, \Gamma, \Delta, q_0, Z_0, F): a finite set of states QQ, an input alphabet Σ\Sigma, a stack alphabet Γ\Gamma, a finite set Δ\Delta of moves (q,x,Z)→(q′,γ)(q, x, Z) \to (q', \gamma) with x∈Σ∪{ε}x \in \Sigma \cup \{\varepsilon\}, Z∈ΓZ \in \Gamma and γ∈Γ∗\gamma \in \Gamma^*, a start state q0q_0, a bottom symbol Z0∈ΓZ_0 \in \Gamma, and accepting states F⊆QF \subseteq Q. In state qq with ZZ on top of the stack, the move reads xx (nothing if x=εx = \varepsilon), goes to q′q' and replaces ZZ by γ\gamma, whose first symbol ends on top. A configuration is a state, the unread input and the stack. The automaton accepts ww if some sequence of moves leads from (q0,w,Z0)(q_0, w, Z_0) to a configuration with no input left and an accepting state.

A PDA for \anbn\. A label x, Z / reads x with Z on top and replaces it by . State 0 pushes an A per a; the move to 1 guesses the middle; state 1 pops an A per b; state 2 is reached when only the bottom Z is left.
A PDA for {anbn}\{a^nb^n\}. A label x,Z/γx, Z / \gamma reads xx with ZZ on top and replaces it by γ\gamma. State 0 pushes an AA per aa; the move to 1 guesses the middle; state 1 pops an AA per bb; state 2 is reached when only the bottom ZZ is left.
Baca dalam konteks →