30 likes | 176 Views
CST229 Week 7. Questions or concerns? Hand back Test#1 & Homework #4 Test1 Average (45/50) Reading: Chapters 12&13 Chapter 12 Grammar – production rules Derivation/Parse Tree How to tell if a grammar is ambiguous In-Class Exercise #5 part 1 Chapter 13
E N D
CST229 Week 7 • Questions or concerns? • Hand back Test#1 & Homework #4 • Test1 Average (45/50) • Reading: Chapters 12&13 • Chapter 12 • Grammar – production rules • Derivation/Parse Tree • How to tell if a grammar is ambiguous • In-Class Exercise #5 part 1 • Chapter 13 • Regular Grammar Production rules • Remove Lambda productions • Remove Unit productions • In-Class Exercise #5 part 2
In-Class Exercise #5 part 1Construct Grammar Production Rules for the following: • All words over {a,b} in which the letter a is never tripled. (i.e. no aaa allowed) • L = {anbm | 2n <= m <= 3n} • L = {anbmck| m = 3k} • L = {anbmck| m = n+k}
In-Class Exercise #5 part 2 • Define a regular grammar for these languages: • All strings over {a,b} with 2 or 3 b’s and no more. • (a+b)*ab(a+b)* • Remove lambda and unit productions from this grammar: S-> aA | aaB A-> aaA | aC | B -> C | bbB C -> cC | c