Lecture 15 Ambiguous Grammars Topics: Context Free Grammars Language generated by a grammar Proofs with L(G) Ambiguous grammars October 20, 2008 CSCE 355 Foundations of Computation
– 2 – CSCE 355 Fall 2008 Last Time: Adversarial game revisited Regular or not Grammars: definitions, derivations, parse trees, languages generated by grammars, L(G)New: Language generated by a grammar Proofs with L(G) Ambiguous grammarsHomework b,c b* {a b c | i != j or j != k} 3. { w in {0,1}* | w is of the form xx} 4. …
– 3 – CSCE 355 Fall 2008 Review: Sentential forms: Leftmost Derivations, Parse Trees E E+E | E*E | (E) | id α is a sentential form if
– 4 – CSCE 355 Fall 2008 References and example real grammars Grammar for Lisp expression ::= atom | list atom ::= number | symbol number ::= [+-]?['0'-'9']+ symbol ::= ['A'-'Z''a'-'z'].* list ::= '(' expression* ')' Grammar.pdf
– 5 – CSCE 355 Fall 2008 Language generated by a grammar L(G)
– 6 – CSCE 355 Fall 2008 L = {0 n 1 n | n >= 1}
– 7 – CSCE 355 Fall 2008 L = { w ε {0,1} * | w has same number of zeroes and ones }
– 8 – CSCE 355 Fall 2008 Proofs about L(G), the language generated by a grammar To prove a language L is the language generated by a grammar G we need to show that L(G) is a subset of L L is a subset of L(G)
– 9 – CSCE 355 Fall 2008
– 10 – CSCE 355 Fall 2008
– 11 – CSCE 355 Fall 2008
– 12 – CSCE 355 Fall 2008
– 13 – CSCE 355 Fall 2008
– 14 – CSCE 355 Fall 2008
– 15 – CSCE 355 Fall 2008