E -> E + T | T T -> T * F | F F -> x | [ E ]
abaaba and bbbb in your simplified grammar.Note that N(P) is the set of nonempty, even-length palindromes over {a,b}.
δ(q0,a,Z0) = {(q1,AZ0)}
δ(q0,b,Z0) = {(q1,BZ0)}
δ(q1,a,A) = {(q1,AA),(q2,ε)}
δ(q1,b,B) = {(q1,BB),(q2,ε)}
δ(q1,a,B) = {(q1,AB)}
δ(q1,b,A) = {(q1,BA)}
δ(q2,a,A) = {(q2,ε)}
δ(q2,b,B) = {(q2,ε)}
δ(q2,ε,Z0) = {(q2,ε)}
It's relatively easy to construct a regular grammar G that accepts L(M), given a DFA M. The idea is that the sentential forms in a leftmost derivation should simply consist of the input already accepted, followed by the current state. So suppose for example that M is the DFA that we used as our first example for going from DFAs to regular expresssions (with A and B used for the names of the states). Then we want to generate the string bbccb by the derivation
A => bA => bbA => bbcB => bbccB => bbccbA => bbccbthat mimics the computation of M on the string. To make this derivation legal, both for the given M and for an arbitrary DFA M, we need to construct a grammar G from M by letting V be Q, T be Σ and S be q0, and by including rules in the grammar as follows: