This assignment is due at start of your section on March 11. Please
read the class policies for collaboration,
cheating, and late assignments. Answers that are unclear, illegible, rambling,
or otherwise annoying will receive no credit. The best answer is the shortest
correct answer.
|
IMPORTANT: Same as always.
Put your name, your section, and your email at the top of
the first page of each part. Don't hand in part 1, though.
|
2. The following grammar in Chomsky normal form generates matched-parenthesis strings:
S | => | SS   |   (S1   |   () |
S1 | => | S) |
(()())
is generated by the grammar.
E | => | E+T   |   T |
T | => | T * F   |   F |
F | => | (E)   |   id |
A Chomsky normal form (CNF) version of this grammar is
E | => | EN1   |   TN1   |   FN1   |   idN1   |   TN2   |   FN2   |   idN2   |   (N3 |
T | => | TN2   |   FN2   |   idN2 |
F | => | (N3 |
N1 | => | +T   |   +F   |   +id |
N2 | => | *F   |  *id |
N3 | => | E)   |   T)   |   F)   |   id) |
Using the CNF form above, or an equivalent one of your own devising, determine whether the strings
x = | (id + id)*id) |
y = | (id) + (id*id) |
END OF ASSIGNMENT 4