tailieunhanh - Lecture Theory of automata - Lecture 39

Corresponding to any CFG there exists a PDA accepting the language generated by the CFG. This chapter presents the following content: PDA corresponding to CFG, examples of PDA corresponding to CFG. | Recap lecture 38 Example of PDA with table for running a string, Equivalent PDA, PDA for EVEN EVEN Language. Non-Derterministic PDA, Example of Non-Derterministic PDA (for EVEN PALINDROME), Definition of PUSH DOWN Automata, Example of Non-Derterministic PDA for S S+S|S*S|4, with table for running running the string 4+4*4, Note for choice of paths at POP state keeping in view left most derivation PDA corresponding to CFG Theorem: Corresponding to any CFG there exists a PDA accepting the language generated by the CFG. Since an algorithm has already been discussed to convert the CFG in CNF, so the PDA can be constructed corresponding to the CFG. As the CFG in CNF generates all the nonnull words of the corresponding CFL, so accepting the null string (if it is contained in the CFL), can be managed separately. Following is an example in this regard Example Consider the following CFG which is in CNF and does not generate the null string S SB|AB A CC B b C a The corresponding PDA . | Recap lecture 38 Example of PDA with table for running a string, Equivalent PDA, PDA for EVEN EVEN Language. Non-Derterministic PDA, Example of Non-Derterministic PDA (for EVEN PALINDROME), Definition of PUSH DOWN Automata, Example of Non-Derterministic PDA for S S+S|S*S|4, with table for running running the string 4+4*4, Note for choice of paths at POP state keeping in view left most derivation PDA corresponding to CFG Theorem: Corresponding to any CFG there exists a PDA accepting the language generated by the CFG. Since an algorithm has already been discussed to convert the CFG in CNF, so the PDA can be constructed corresponding to the CFG. As the CFG in CNF generates all the nonnull words of the corresponding CFL, so accepting the null string (if it is contained in the CFL), can be managed separately. Following is an example in this regard Example Consider the following CFG which is in CNF and does not generate the null string S SB|AB A CC B b C a The corresponding PDA will be PH S AT ST RD1 a RD2 S PP ∆ B ∆ S RD3 PH B PH S PH C PH C C b PH B PH A A Example continued Here the STACK alphabet = {S, A, B, C}, where the TAPE alphabet ={a, b} Note: It may be noted that when the POP state is entered either a nonterminal is replaced by two nonterminals at the top of the STACK accommodating a production, or a nonterminal is popped out from the top of the stack and a READ state is entered to read a specified letter from the TAPE or else the machine crashes. Example continued The choice of path taken at POP state to accommodate the word belonging to the CFL can be determined by the left most derivation of the word. Consider the word aab with its left most derivation, as follows Example continued Working-String Generation Production Used S AB S AB step 1 CCB A CC step 2 aCB C a step 3 aaB C a step 4 aab B b step 5 Example continued First of all the START state is entered The PUSH S state is entered aab∆ ∆ TAPE STACK aab∆ S TAPE .

TỪ KHÓA LIÊN QUAN