CS 381 Homework #7 Problem 1
S
→
S
1
| S
2
S1
→
AC
case where i = j
A
→
aAb
A
→
ε
C
→
cC
C
→
ε
S
2
→
aS
2
c
case where i = k
S
2
→
B
B
→
bB
B
→
ε

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
Write a cfg for the complement of {ww
R
| w
∈
(a + b)*}
S
barb2right
a S a | b S b | a E b | b E a | a | b
E
barb2right
a E | b E |
ε
Course
381
Homework
7
Problem
2

CS 381 Homework #7 Problem 3
Twice as many b’s as a’s
S
→
SaSbSbS | SbSaSbS | SbSbSaS |
ε

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
CS 381 Homework #7 Problem 4
Convert regular set to its corresponding DFA, M and have all its states be variables in the
CFL, G. The alphabet of G is that of M.
For every
δ
(q
n
, a) = p, there’s a corresponding Q
n
→
aP
For every q
f
∈
F in the DFA, there’s a corresponding Q
f
→
ε
Let S
→
Q
0