1.分别写出描述以下语言的正规文法和正规式:
L1={abna|n≥0}。
L2={ambn|n≥1,m ≥1}
L2={(ab)n|n≥1}
2.将以下正规文法转换到正规式
Z→0A
A→0A|0B
B→1A|ε
Z→U0|V1
U→Z1|1
V→Z0|0
S→aA
A→bA|aB|b
B→aA
I→L | IL | Id
1(1)正规文法:A → aBa B → Bb | ε
正规式: A = ab*a
(2) 正规文法: S → AB A → aA | a B → bB | b
正规式: S = aa*bb*
(3) 正规文法: S → aA A → bB B → aA | ε
正规式: S = (ab)*(ab)
2(1) A = 0A + 0(1A+ ε) = 0A + 01A + 0 = A(0+01) + 0 = (0+01)*0
Z = 0(0 + 01)*0 = 0(0 | 01)*0
(2) Z = (Z1 + 1)0 + (Z0 + 0)1 = Z10 + 10 + Z01 +01 = Z(10 + 01) +10 + 01 = (10 + 01)*10 | 01
(3) A = bA + aaA + b = A(b + aa) + b = (b + aa)*b
S = a(b + aa)*b
(4) I = L + IL + Id = I(L + d) + L = (L + d)*L