PDA: Sequence of moves By Diana Castro. PDA: Sequence of moves for aaabbb Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Advertisements

Top-Down PDA Sequence of steps to which string X= [][[][]] has to be accepted by NPDA NT(G) Grammar has productions s  [S]S|^
Top-down Parsing By Georgi Boychev, Rafal Kala, Ildus Mukhametov.
142 Parsing start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) ( , Z 0 /Z 0 ) For a given CFG G, parsing a string w is to check if w  L(G) and, if it is,
1 Module 32 Pushdown Automata (PDA’s) –definition –Example We define configurations and computations of PDA’s We define L(M) for PDA’s.
CS 310 – Fall 2006 Pacific University CS310 Pushdown Automata Sections: 2.2 page 109 October 11, 2006.
start 0, 4, 8 1, 5, 9 2, 6 3, 7 2 0,4,8 2, 6 3, 7 1, 5, 9 to state 2 to state 3 to state 1 to state 0 to state 1 to state 3 to state 0 to state.
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.

Fall 2006Costas Busch - RPI1 Pushdown Automata PDAs.
1 Lecture 32 CFG --> PDA construction –Shows that for any CFL L, there exists a PDA M such that L(M) = L –The reverse is true as well, but we do not prove.
Pushdown Automaton (PDA)
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
CSCI3130: Formal Languages and Automata Theory Tutorial 4 Tutor: William Chow.
Chapter 7 PDA and CFLs.
نظریه زبان ها و ماشین ها فصل دوم Context-Free Languages دانشگاه صنعتی شریف بهار 88.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
CSCI 2670 Introduction to Theory of Computing September 20, 2005.
Context-free Languages Chapter 2. Ambiguity.
Pushdown Automata Part I: PDAs Chapter Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2)
Lecture # 28 Theory Of Automata By Dr. MM Alam 1.
Push-down Automata Section 3.3 Fri, Oct 21, 2005.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Lecture 20 DPDA / Review Topics Given a PDA construct a grammar for the language it accepts Deterministic PDAs Properties of CFLsReadings: November 5,
Mathematical Notions and Terminology Lecture 2 Section 0.2 Fri, Aug 24, 2007.
1 Turing Machines Reading: Chapter 8. 2 Turing Machines are… Very powerful (abstract) machines that could simulate any modern day computer (although very,
Lecture # 22. PDA of language {a n b n : n=0,1,2,3, …}
Chapter 7 Pushdown Automata
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
1 Pushdown Automata There are context-free languages that are not regular. Finite automata cannot recognize all context-free languages.
January 20, 2016CS21 Lecture 71 CS21 Decidability and Tractability Lecture 7 January 20, 2016.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 154 Formal Languages and Computability March 15 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
Theory of Computation Pushdown Automata pda Lecture #10.
Regular Languages, Regular Operations, Closure
Arithmetic and Geometric Means
Parsing Bottom Up CMPS 450 J. Moloney CMPS 450.
Theory of Automata.
Theorem 29 Given any PDA, there is another PDA that accepts exactly the same language with the additional property that whenever a path leads to ACCEPT,
PDA’s - A new format for FAs
Theory of Computation Lecture # 9-10.
Mathematical Notions and Terminology
Pushdown Automata PDAs
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Pushdown Automata PDAs
Pushdown Automata PDAs
PUSHDOWN AUTOMATA. PUSHDOWN AUTOMATA Hierarchy of languages Regular Languages  Finite State Machines, Regular Expression Context Free Languages 
Push-down Automata.
AUTOMATA THEORY VI.
Principles of Computing – UFCFA3-30-1
Which description shows the relationship between a
NFAs and Transition Graphs
4n + 2 1st term = 4 × = 6 2nd term = 4 × = 10 3rd term
Midterm #2 — Review problems
Key to Homework #8 1. For each of the following context-free grammars (a) and (b) below, construct an LL(k) parser with minimum k according to the following.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Recap lecture 37 New format for FAs, input TAPE, START, ACCEPT , REJECT, READ states Examples of New Format of FAs, PUSHDOWN STACK , PUSH and POP states,
Recap lecture 40 Recap of example of PDA corresponding to CFG, CFG corresponding to PDA. Theorem, HERE state, Definition of Conversion form, different.
More About Nondeterminism
LECTURE # 07.
Presentation transcript:

PDA: Sequence of moves By Diana Castro

PDA: Sequence of moves for aaabbb Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 1 st Move: (q 0, aaabbb, Z 0 ) ⊦ Initial State: q 0 Initial Stack Symbol: Z 0 Accepting State: q 3

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 1 st move with the table (q 0, aaabbb, Z 0 ) ⊦ Next Move

1. (q 0, aaabbb, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 2 nd Move (q 1, aabbb, aZ 0 ) ⊦ New State Unread part of the string Add a to the Stack

1. (q 0, aaabbb, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 2 nd move with the table (q 1, aabbb, aZ 0 ) ⊦ Next Move

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 3 rd Move (q 1, abbb, aaZ 0 ) ⊦ New State Unread part of the string Add a to the Stack

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 3 rd move with the table (q 1, abbb, aaZ 0 ) ⊦ Next Move

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 4 th Move (q 1, bbb, aaaZ 0 ) ⊦ New State Unread part of the string Add a to the Stack

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 4 th move with the table (q 1, bbb, aaaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 5 th Move (q 2, bb, aaZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aaZ 0 are left on the Stack.

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 5 th move with the table (q 2, bb, aaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 5 th Move (q 2, bb, aaZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aaZ 0 are left on the Stack.

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 5 th move with the table (q 2, bb, aaZ 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 6 th Move (q 2, b, aZ 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and aZ 0 are left on the Stack.

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 6 th move with the table (q 2, b, a Z 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 7 th Move (q 2, Λ, Z 0 ) ⊦ New State Unread part of the string Pop the Stack. In this case we Pop a, and Z 0 are left on the Stack.

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) Match the 7 th move with the table (q 2, Λ, Z 0 ) ⊦ Next Move 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦

1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, bbbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ 7.(q 2, Λ, Z 0 ) ⊦ Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 8 th Move (q 3, Λ, Z 0 ) ⊦ New State Unread part of the string The stack remains empty

Move No. StateInputStack Symbol Move(s) 1q0q0 aZ0Z0 (q 1, aZ 0 ) 2q1q1 aa(q 1, aa) 3q1q1 ba(q 2, Λ) 4q2q2 ba 5q2q2 ΛZ0Z0 (q 3, Z 0 ) 1.(q 0, aaabbb, Z 0 ) ⊦ 2.(q 1, aabbb, aZ 0 ) ⊦ 3.(q 1, abbb, aaZ 0 ) ⊦ 4.(q 1, bbb, aaaZ 0 ) ⊦ 5.(q 2, bb, aaZ 0 ) ⊦ 6.(q 2, b, aZ 0 ) ⊦ 7.(q 2, Λ, Z 0 ) ⊦ 8.(q 3, Λ, Z 0 ) String is accepted! Done