Compiler Construction. Recursive Descent Parsing! I having a hard time with this
ID: 3729066 • Letter: C
Question
Compiler Construction. Recursive Descent Parsing! I having a hard time with this question. Please help! The class is based on "The Dragon Book" which can be downloaded in pdf for free by just typing the title of the book. This is chapter 4 stuff, LL(1) parsing etc....
We need to Computer the FIRST(A), FIRST(B), FIRST(C), FOLLOW(A), FOLLOW(B), FOLLOW(C)
FIRST and FOLLOW Sets Question 1 [20 points] Consider the following context-free grammar ·[6/201 Compute FIRST(A), FIRST(B), FIRST(C) ·19/201 Compute FOLLOW(A), FOLLOW(B), FOLLOW(C)Explanation / Answer
1.To find FIRST SET we need to follow the following procedure:
from the above production rules ,we can make it in the left recursion form:
In the first set ,to find FIRST(A) first we need to find FIRST(B) and FIRST(C).similarlily to find FIRST(B) we need to find FIRST(C).
Such that:
2.FOLLOW SET:
Follow(X) to be the set of terminals that can appear immediately to the right of Non-Terminal X in some sentential form.
1.initiaally we start with empty sets.
2.In the first round:
3.In the second round:
4.In the third round:
5.In the fourth round:
Here we need to stop as there is no change.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.