This is an old revision of the document!
11. Context-Free Grammars AGAIN
11.1. Chomsky Normal Form
11.1.1 Write the following grammars in CNF:
$ S \leftarrow 0SA \mid ASB \\ A \leftarrow 0BA \mid 1S \mid 0A \\ B \leftarrow B1 \mid 0B \mid 1 \mid 0 $
$ S \leftarrow ABC \\ A \leftarrow aAb \mid \epsilon \\ B \leftarrow bBc \mid bc \\ C \leftarrow cC \mid c $
11.1.2 Write a CNF grammar for $ L(b^*(a \cup c)^+b^+)$ . Un pic prea stufos si cu prea multa munca manuala. Eu l-as scoate.
11.2. Regular Grammars
11.2.1 Give an example of a regular grammar that generates $ L(0^*1^*) $.
11.2.2 Give an example of a regular grammar that generates $ L((0 \cup 10(1^*00 \cup \epsilon)1(01 \cup 0^+)^*10^+)) $. Un pic prea stufos si cu prea multa munca manuala. Eu l-as scoate.
11.3. DFA to Regular Grammar
11.3.1 For each of the following DFAs, algorithmically create a regular grammar that generates the same language.
Un pic prea stufos si cu prea multa munca manuala. As scoate ultimele 2 exercitii.
11.4. Short Exercises
11.4.1 Can a regular Grammar be in Chomsky Normal Form?
11.4.2 Write an algorithm that verifies whether or not a Regular Grammar generates an infinite language.
11.4.3. Prove that any DFA can be converted to a regular grammar.
11.4.5. Is there a decidable algorithm to remove ambiguity from regular grammars?
11.4.6. Show the following grammar is ambiguous: $ S \leftarrow aSbS $ . Write a non-ambiguous equivalent.
The exercises below may be a little to basic for this stage of the lecture:
11.4.3 When can a PDA be turned into a regular grammar?
11.4.4 Given a language $ L $ generated by a regular grammar, can we convert it into a regular expression that accepts $ \overline{L} $ ?
11.4.5 Let $ e $ be a regular expression. Is it possible to create a context-free grammar that generates $ L(\overline{e}) $?