70 likes | 224 Views
Regular Grammars. Right-linear Grammar. A grammar G=(V,T,S,P) is right-linear if all productions are of the form A -> xB, or A -> x where A,B V, and x T*. Language of RL Grammar. Claim: For all right-linear grammars G, L(G) is regular Proof by construction. A RL Grammar for a RL.
E N D
Right-linear Grammar • A grammar G=(V,T,S,P) is right-linear if all productions are of the form • A -> xB, or • A -> x where A,B V, and x T*
Language of RL Grammar • Claim: For all right-linear grammars G, L(G) is regular • Proof by construction
A RL Grammar for a RL • For any regular language L over alphabet ∑, there is a right-linear grammar G=(V,∑,S,P) such that L = L(G) • Proof by construction
Questions (1/3) • Is the language of the grammar G1 = ({S,A},{a,b},S,{S -> aS | A, A -> bA}) a regular language? • If it is, give an FA with the same language.
Questions (2/3) • Is the language of the grammar G2 = ({S,B}, {a,b}, S, {S -> aB | λ, B -> Sb}) a regular language? • If so, give an FA with the same language as G2.
Questions (3/3) • Give a regular grammar with the same language as the following DFA. c q1 a,b b a,b,c a q0 q3 c b q2 c a