Download presentation
Presentation is loading. Please wait.
Published byLuke Martin Modified over 8 years ago
1
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
– 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 1. 5.1.2 b,c 2. 5.1.7b* {a b c | i != j or j != k} 3. { w in {0,1}* | w is of the form xx} 4. …
3
– 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
– 4 – CSCE 355 Fall 2008 References and example real grammars http://en.wikipedia.org/wiki/Context-free\_grammar http://en.wikipedia.org/wiki/Programming\_language Grammar for Lisp expression ::= atom | list atom ::= number | symbol number ::= [+-]?['0'-'9']+ symbol ::= ['A'-'Z''a'-'z'].* list ::= '(' expression* ')' http://marvin.cs.uidaho.edu/~heckendo/CS445S07/c- Grammar.pdf
5
– 5 – CSCE 355 Fall 2008 Language generated by a grammar L(G)
6
– 6 – CSCE 355 Fall 2008 L = {0 n 1 n | n >= 1}
7
– 7 – CSCE 355 Fall 2008 L = { w ε {0,1} * | w has same number of zeroes and ones }
8
– 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
– 9 – CSCE 355 Fall 2008
10
– 10 – CSCE 355 Fall 2008
11
– 11 – CSCE 355 Fall 2008
12
– 12 – CSCE 355 Fall 2008
13
– 13 – CSCE 355 Fall 2008
14
– 14 – CSCE 355 Fall 2008
15
– 15 – CSCE 355 Fall 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.