Course Solutions Uncategorized (Solved) : 3 Consider Following Context Free Grammar Bnf Non Terminals Id Terminals R1 R2 R3 Id R4 5 Q34696696 . . . .

(Solved) : 3 Consider Following Context Free Grammar Bnf Non Terminals Id Terminals R1 R2 R3 Id R4 5 Q34696696 . . . .

 

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. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post