This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Homework 8 CISC 303 Timo Kötzing ([email protected]) Monday, April 20.
Friday, April 24. Handed out:
Due Date:
Problem 1. (8 points) (i) Design a total acceptorTM M such that L(M) = {an bn cn  n ≥ 0}.
(ii) Design a total functionTM f such that, for any words w0 , w1 , . . . , wn , f ( w0 w1  . . . wn ) = w1 .
Problem 2. (8 points) (i) Consider the grammar G0 = ({a, b}, {S, X, Y, Z, V, W }, P, S ) with P as follows. S → V aa  ε (1) X → bS  aba (2) Y → W V W  bba  S (3) Z
V → aX  ε
→ XY (4) W → SY (6) (5) Compute, iteration by iteration, the reachable symbols of G0 , analogous to Example 2.5.4 in the Lecture Notes.
(ii) Consider the grammar G1 = ({a, b}, {S, X, Y, Z, V }, P, S ) with P as follows. S → aY  X (7) X → bZ  aSZ (8) Y → bV b  S (9) Z → aaZaa  ZY a  Xa (10) V → Xε (11) Compute, iteration by iteration, the productive symbols of G1 , analogous to Example 2.5.6 in the Lecture Notes.
(iii) Consider the grammar G2 = ({a, b}, {S, X, Y, Z, V, W }, P, S ) with P as follows. S → bXY a  ZaW (12) X → bX  aX (13) Y → bW b  ε (14) Z → Xb  Za  W a (15) V → aW W a  b (16) W → aba  aSa  ε (17) Apply removeUselessSymbolsCFG, as given in Algorithm 2.5.7 in the Lecture Notes, on G2 .
Problem 3. (8 points)
Consider the grammar G3 = ({a, b}, {S, X, Y }, P, S ) with P as follows. S → bXY a  a (18) X → bX  aX  SS (19) Y → bXbSSa  ab (20) Apply CFGtoCNF, as given in Algorithm 2.5.13 in the Lecture Notes, on G3 (see Examples 2.5.14 and 2.5.15.
Problem 4. (8 points)
This is an extra credit problem. 1 Homework 8 CISC 303 Timo Kötzing ([email protected]) (i) Let G = (A, N, P, S ) be a grammar, such that, for all X → α ∈ P , either α = ε, or α = xY for some x ∈ A and
Y ∈ N . Construct an NFA M such that L(M) = L(G). Conclude that G accepts a regular language.
(ii) Let M be an NFA. Construct a grammar G = (A, N, P, S ) such that L(M) = L(G) and, for all productions
X → α ∈ P , either α = ε, or α = xY for some x ∈ A and Y ∈ N . 2 ...
View
Full Document
 Spring '08
 Carberry,M
 Trigraph, Timo Kötzing, [email protected]

Click to edit the document details