3. Consider the following context-free grammar in BNF, where andare non-terminals and +, -, and id are terminals.<E>::=<E> +<E> (r1)
<E>::=<E> -<E> (r2)
<E>::=<T> (r3)
<T>::= id (r4)
a. (5 points) Construct parsing steps for the string “id + id -id” in the grammar and state whether or not the string is asentence in the language. Solution:
b. (5 points) Draw a parse tree from (a) Solution:
c. (5 points) Prove that the grammar is ambiguous Solution
d. (5 points) Disambiguating the grammar. Solution:
Expert Answer
An answer will be send to you shortly. . . . .