1. Describe the following languages regular grammar and formal style:
L1={abna|n≥0}。
L2={ambn|n≥1,m ≥1}
L3={(ab)n|n≥1}
2. Convert the following regular grammar to the regular formula
0A → Z
A → 0A | 0B
B → 1A | e
Z→U0|V1
U→Z1|1
V→Z0|0
S → aA
A → bA | aB | b
B → aA
I → l | The | A
----------------------------------------------------------------------------------
1、
L1={abna|n≥0}
Regular grammar: regular style:
S→aA B=ε+bB=b*
A → A = = b *
B → bB | e = aA = S ab * al
L2={ambn|n≥1,m ≥1}
Regular grammar: regular style:
S→AB A=aA+a=a*a
A→aA|a B=bB+b=b*b
B→bB|b S=AB=aa*bb
L3={(ab)n|n≥1}
Regular grammar: regular style:
S→ab|abS S=ab+abS
=ab(1+S)
=ab(ab)*
----------------------------------------------------------------------------------
2、
With 0A → Z → U0 | V1
0A → A | 0B → U Z1 | 1
Breakfast 1A → | e V → Z0 | 0
Regular Expression: regular type:
A=0A|0B U=Z1+1
0B = 0 A + W = Z0 + 0
= 0A + 0 (1A + e) Z = 00 + V1
=0A+01A+0 =(Z1+1)0+(Z0+0)1
=(0+01)A+0 =Z10+10+Z01+01
= (0101) * 0 = (Z + 1) (10 + 01)
Z=0A=0(0101)*0 =(10101)*(10101)
E → → AA I l | Il | Id
A → BA | AB | b
B → Aa
Regular Expression: regular type:
A = BA + AB + b = I + II + Be
BA + = a (AA) + b = I + I (I + d)
=(b+aa)A+b =I(I+d)*
=(b1aa)*b =III(d)*
S=aA=a(b1aa)*b