3. Give a context-free grammar for the following language L:
L= {w?{a,b,c,d}* | w does not contain the substring abc}
4. Consider the grammar G=({S}, {a,b},S,P) where P is the following set of productions:
S ? aSb | aSbb | ?
Show that the above grammar is ambiguous by finding a string with two different
derivation trees. You must give the string and draw the two derivation trees.
5. Consider the following grammar G=({S,A,B,C}, {a,b,c},S,P) where P is the following
set of productions:
S ? AB | BCS | AaC
A ? aA | C
B ? bbB | b
C ? cC | ?
Use the algorithm that we discussed in class (and is given in the Linz textbook) to
produce an equivalent grammar G' that does not contain any ?-productions.
6. Consider the following grammar G=({S,A,B,C}, {a,b,c}, S, P) where P is the following
set of productions:
S ? A | C
A ? aA | a | B
B ? bB | b
C ? cC | c | B
Use the algorithm that we discussed in class (and is given in the Linz textbook) to
produce an equivalent grammar G' that does not contain any unit productions. You
must show your work, including the variable dependency graph, not just give the final
grammar.