Objectives:
Objective of this assignment is to assess the understanding of students about
concept of context free grammars, parsing tree, ambiguous CFG.
Instructions:
Please read the following instructions carefully before submitting assignment:
- You should consult the recommended books, PowerPoint slides and audio lectures to clarify your concepts.
- You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, zip, rar and bmp etc will not be accepted.
- It should be clear that your assignment will not get any credit if:
· The assignment is submitted after due date.
· The assignment is copied from Internet or from any other student.
· The submitted assignment does not open or file is corrupt.
Note: No assignment will be accepted after the due date through email in any case (load shedding, server down, internet malfunctioning etc.).
It is recommended to upload solution file at least two days before its closing date.
Question No 1: Marks=5
What will be the CFG for the given regular expression?
a+b+(a+b)+
Question No 2: Marks=5
Calculate the prefix arithmetic expression from the following derivation tree. Show all steps to get the final answer.
Question No 3: Marks=5
Prove that the given CFG is ambiguous.
S→AB
A→a|aA|aaA
B→b|bB| Λ
run:yes'> Marks=5
What will be the CFG for the given regular expression?
a+b+(a+b)+
Solutions
a+b+(a+b)+
Solution 1:
SàX
SàY
Xàa
xàb
YàaX
YàbX
Solution No.2:
+2-+50 6*96
+2-56 54
+2-2
0
Note:
please subscribe and follow my blog for updates