Q 8. Consider the context-free grammar G with terminal symbols T = {x, y, e, -1, (, )}, non-terminal symbols N = {σ, F, B}, starting symbol σ, and production rules
σ → Fσ | F
F → B | B-1
B → x | y | e | (Fσ)
Note that we are regarding -1 as a single symbol. The string B-1, for example, has length 2; it is the symbol B followed by the symbol -1.
(a) Give leftmost derivations in G for each of the following strings.
(i) e-1 (ii) y-1x-1 (iii) xyx-1y-1
(b) Use the method of Lecture 8B to draw the transition diagram of a PDA accepting the language generated by G. State the input alphabet and the stack alphabet of your PDA.
(c) Show how your PDA in (b) accepts the string y-1x-1. Your answer to (a)(ii) will be useful.