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

(Solved) : Consider Relational Database Student Sid Sname Gpa Age Apply Sid Cname Major Decision Coll Q32478825 . . . .(Solved) : Consider Relational Database Student Sid Sname Gpa Age Apply Sid Cname Major Decision Coll Q32478825 . . . .

<p>Consider the Relational Database:<br/>STUDENT [<strong>sID</strong>, sName, GPA, age]<br/>APPLY [ <strong>sID</strong>, <strong>cName</strong>, Major,Decision]<br/>COLLEGE [<strong>CName</strong>, State]</p><p>where APPLY.sID REFERENCES STUDENT.sID and APPLY.cNameREFERENCES COLLEGE.CName</p><p>Using SQL queries to find:</p><p>a. The list of students who applied