@zareen FIN625 Assignment 1 Solution and Discussion
CS606 Assignment 2 Solution and Discussion

CS606 – Compiler Construction
Assignment # 02
Fall 2019
Total marks = 20Deadline Date
2nd December, 2019Please carefully read the following instructions before attempting assignment.
RULES FOR MARKING
It should be clear that your assignment would not get any credit if:
The assignment is submitted after the due date.
The submitted assignment does not open or file is corrupt.
Strict action will be taken if submitted solution is copied from any other student or from the internet.You should consult the recommended books to clarify your concepts as handouts are not enough.
You are supposed to submit your assignment in .doc or docx format.
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc will not be accepted.OBJECTIVE
Objective of this assignment is to increase the learning capabilities of the students about
• ContextFree Grammars
• Ambiguous Grammars
• Unambiguous GrammarsNOTE
No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.
If you find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.
For any query, feel free to email at:
[email protected]Questions No 01 10 marks
Consider the grammar given below:
NP > Adj NP
NP > NP Conj NP
NP > Adj N
NP > N
Adj > Young
Conj > and
N > Boys  GirlsWhere “Young, and, boys, Girls “ are terminals and “NP, N, Adj, Conj” are nonterminals.
Prove or disprove that the grammar given above is ambiguous.Questions No 02 10 marks
Consider the grammar given below:
S > S + S  S / S  10  11  12  13  14  15  16  17  18  19
Prove that above given grammar is ambiguous.
Good Luck!

Ideas Solution
Q No 01
Solution:
NP > Adj NP
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.
NP > NP Conj NP
The draw parse trees for above given grammar:
The above grammar has two different parse trees therefore the given grammar is ambiguous.NP > Adj N
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.
NP >N
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.
Adj > Young
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.Conj > and
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.N > Boys  Girls
The draw parse trees for above given grammar:
The above given grammar have only one parse tree so it is nonambiguous grammar.
Q No 02
Solution:
The given grammar is
S > S + S  S / S  10  11  12  13  14  15  16  17  18  19
The draw parse trees for above given grammar:
Parse Trees:
The above grammar has two different parse trees therefore the given grammar is ambiguous.
THE END!
Recent Topics

CS606 Assignment 3 Solution and Discussion
CS606  Compiler Construction48 
MTH603 Quiz 1 Solution and Discussion
MTH603  Numerical Analysis29 
CS508 Quiz 2 Solution and Discussion
CS508  Modern Programming Languages20 
ENG101 Assignment 2 Solution and Discussion
ENG101  English Comprehension10 
MTH603 Quiz 2 Solution and Discussion
MTH603  Numerical Analysis9 
PSY610 Assignment 2 Solution and Discussion
PSY610  Neurological Bases of Behaviour8 
CS431 Assignment 3 Solution and Discussion
CS431  Wireless Communication8 
CS314 Assignment 3 Solution and Discussion
CS314  Introduction to Cellular Networks6 
CS315 Assignment 2 Solution and Discussion
CS315  Network Security6 
CS315 Assignment 3 Solution and Discussion
CS315  Network Security6 
SOLVED SOC101 Assignment 1 Solution and Discussion
SOC101  Introduction to Sociology5 
Why http url auto redirect to https?
Development Troubleshooting5 
EDU431 Assignment 3 Solution and Discussion
EDU431  Test Development & Evaluation5 
BT603 Assignment 2 Solution and Discussion
BT603  Fermentation Technology5 
CS605 Assignment 3 Solution and Discussion
CS605  Software EngineeringII4 
BIO204 Assignment 2 Solution and Discussion
BIO204  Principles of Biochemical Engineering4 
CS408 Assignment 3 Solution and Discussion
CS408  Human Computer Interaction4 
PAK301 Assignment 2 Solution and Discussion
PAK301  Pakistan Studies4 
ENG505 Assignmnet 2 Solution and Discussion
ENG505  Language Learning Theories4 
PAD603 Assignment 1 Solution and Discussion
PAD603  Governance, Democracy and Society4