CS150 HW4
Set May 6
Due May 20 (at 3pm)
Total: 70 pts
Q1 [10 pts] Construct a CFG for the set of all ternary strings of
the form 0^i 1^j 2^k, where i = j + k.
Q2 [10 pts] P. 193 (or P. 191 in 2nd ed) Ex.5.2.1. That is:
For the grammar and each of the strings in Ex. 5.1.2, give parse trees.
Q3 [20 pts] P. 216 (or P. 215 in 2nd ed) Ex.5.4.7.
The following grammar generates ...
Hint: For part b, show that the leftmost derivation is unique
for any given input string, similar to the example given in
the lecture notes (after slide 169).
Q4 [10 pts] PP. 233-4 (or P. 228 in 2nd ed) Ex.6.1.1: b), c)
Q5 [20 pts] P. 241 (or P. 236 in 2nd ed) Ex.6.2.1: b), c)
For each PDA, please show the transition diagram instead of a set
transitions.