1. Trang chủ
  2. » Công Nghệ Thông Tin

Chapter 7: Pushdown Automata

35 194 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 35
Dung lượng 143 KB

Nội dung

Chapter 7: Pushdown Automata Quan Thanh Tho qttho@cse.hcmut.edu.vn 2 Pushdown Automata • There are context-free languages that are not regular. • Finite automata cannot recognize all context-free languages. 3 Example 7.1 • {a, b}* is regular. • {akbk | k is a constant} is regular. • {anbn | n ≥ 0} is not regular. 4 Pushdown Automata Control unit q 0 Input file yes/no Stack 5 Non-deterministic Pushdown Automata (NPDA) M = (Q, ∑, Γ, δ, q 0 , z, F) Q: finite set of internal states ∑: finite set of symbols - input alphabet Γ: finite set of symbols - stack alphabet δ: Q × (∑∪{λ}) × Γ → finite subsets of Q × Γ* transition function q 0 ∈ Q: initial state z ∈ Γ: stack start symbol F ⊆ Q: set of final states 6 Transition Function δ: Q × (∑∪{λ}) × Γ → finite subsets of Q × Γ* stack top stack top replacement 7 Example 7.2 δ(q 1 , a, b) = {(q 2 , cd), (q 3 , λ)} b d c q 1 q 2 q 3 8 Example 7.3 M = (Q, ∑, Γ, δ, q 0 , z, F) Q = {q 0 , q 1 , q 2 , q 3 } δ(q 0 , a, 0) = {(q 1 , 10), (q 3 , λ)} ∑ = {a, b} δ(q 0 , λ, 0) = {(q 3 , λ)} Γ = {0, 1} δ(q 1 , a, 1) = {(q 1 , 11)} z = 0 δ(q 1 , b, 1) = {(q 2 , λ)} F = {q 3 } δ(q 2 , b, 1) = {(q 2 , λ)} δ(q 2 , λ, 0) = {(q 3 , λ)} 9 Instantaneous Description (q, w, u) current state unread part of stack contents input string 10 Instantaneous Description Move move: (q 1 , aw, bx) | (q 2 , w, yx) iff (q 2 , y) ∈ δ(q 1 , a, b) [...]... S, P) T=Σ V = {(q Aq ) | A ∈ Γ} i j S = (q zq ) 0 f P: (q Aq ) → a iff (q , λ) ∈ δ(q , a, A) i j j i (q Aq ) → a(q Bq )(q Cq ) iff (q , BC) ∈ δ(q , a, A) i m i m m j j i 31 Deterministic Pushdown Automata A DPDA is a pushdown automaton that never has a choice in its move: 1 2 δ(q, a, b) contains at most one element if δ(q, λ, b) is not empty, then δ(q, a, b) must be empty for every a ∈ Σ 32 Deterministic . Chapter 7: Pushdown Automata Quan Thanh Tho qttho@cse.hcmut.edu.vn 2 Pushdown Automata • There are context-free languages that are not regular. • Finite automata cannot recognize all. is regular. • {anbn | n ≥ 0} is not regular. 4 Pushdown Automata Control unit q 0 Input file yes/no Stack 5 Non-deterministic Pushdown Automata (NPDA) M = (Q, ∑, Γ, δ, q 0 , z, F) Q: finite set

Ngày đăng: 13/05/2014, 10:21

TỪ KHÓA LIÊN QUAN

w