Download presentation
Presentation is loading. Please wait.
Published byEmil Norris Modified over 8 years ago
1
Transparency No. 1 Formal Language and Automata Theory Homework 6
2
Homework Transparency No. 2 PDA 1.Design a PDA (accepting by empty stack) to accept the language L 1 = { x {a,b}* | x contains the same number of a's and b's. 1.1 Sketch your pseudo code 1.2 Draw its transition diagram 1.3 Give a formal definition of the machine. Namely, suppose the machine is M = (Q, , , ,s, , F), then you should list the content of each component of the machine.
3
Homework Transparency No. 3 PDA 2. Design a PDA to accept the language L 2 = { xy {a,b}* | |x| = |y| but x y }. 1.1 Sketch your pseudo code 1.2 Draw its transition diagram 1.3 Give a formal definition of the machine. Namely, suppose the machine is M = (Q, , , ,s, , F), then you should list the content of each component of the machine. Also remember to specify that your PDA accepts either by empty stack or by final state.
4
Homework Transparency No. 4 Equivalence of CFG and PDA 3.Find a single-state PDA M = (Q, , , ,s, , { }) which accepts by empty stack and is equivalent to the following CFG: S ABS | AB A aA | a B bA 4.Let PDA M2 = ({p,q}, {0,1}, {A, X}, , p, X, {q}) where X is the bottom symbol, and is given as follows: (p, 0, X) (p,AX), (q,1, A) (q, ) (p, 0, A) (p, AA), (q, , A) (q, ) (p. 1, A) (q, ),(q, , X) (q, ). Suppose M2 accepts by final state and empty stack, i.e., x is accepted iff (p, x, X) * (q, , ). Find a CFG equivalent to M2.
5
Homework Transparency No. 5 STM programming 5. Design a standard Turing machine (TM) M to accept the language of all palindromes P = { x ∈ {0,1}* | x = reverse(x) }. On input x ∈ {0,1}* of length n, the machine will start its execution on the initial configuration (s, [x, 0) and ends on the accept state t with the final configuration (t,[ … …, -). The following is an informal description for M: 1.R (i.e., Move right ) 2.case(input) of { 3. ‘ ’(blank) => goto_t (accept) 4. ‘0’ => 5. ‘ ’ (i.e., write ) R Move_right_until_ L(i.e., move left) 6. case (input) of { 7. ‘ ’(blank) => goto t (accept) 8. ‘0’ => ‘ ’ L (Move_left_until_ ) goto_1 9. ‘1’, ‘[‘ => goto_r (reject) } 10. ‘1’ => ‘ ’ R Move_right_until_ L 11. case (input) of { 12. ‘ ’(blank) => goto_t (accept) 13. ‘1’ => ‘ ’ L Move_left_until_ goto _1 14. ‘0’, ‘[‘ => goto_r (reject) } 15.} t : halt r : halt
6
Homework Transparency No. 6 5.1 translate the above description into (flow-chart-like) state-transition diagram 5.2 Write your formal result using the following table: state\ \ symbol [01 ss tFhalt rFhalt
7
Homework Transparency No. 7 CSL and CSG 6. The language A = {xx | x {a,b}* } is not context-free but context-sensitive. Design a context-sensitive grammar(CSG) for it.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.