Professional Documents
Culture Documents
Dhaka University of Engineering & Technology, Gazipur
Dhaka University of Engineering & Technology, Gazipur
Assignment No: 02
SUBMITTED TO SUBMITTED BY
Name: Md. Niaz Morshed Ganesh chandro ray
Asst. Professor, Dept. of CSE, DUET ID: 164030
For Example:
Let us consider this grammar : E -> E+E|id
Input string : id+id+id
Leftmost Derivation:
E->E+E E->E+E
E->id +E E->E+E+E
E->id+E+E E->id+E+E
E->id+id+E
E->id+id+E
E->id+id+id
E->id+id+id
We can create 2 parse tree from this grammar to obtain a string id+id+id :
The following are the 2 parse trees generated by left most derivation:
Both the above parse trees are derived from same grammar rules but both parse trees are
different. Hence the grammar is ambiguous.
Conclusion: Above the lab experiment, implement the grammar is ambiguous or not.