![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
![]() |
![]() |
![]() ![]() |
Author | Message |
balu
Senior Member ![]() Joined: 20Feb2007 Online Status: Offline Posts: 236 |
![]() ![]() ![]() Posted: 22Feb2007 at 2:21pm |
CS 1992 Q 2 xii. For a context-free grammar, FOLLOW(A) is the set of terminals that can appear immediately to the right of non-terminal A in some "sentential" form. We define two sets LFOLLOW(A) and RFOLLOW(A) by replacing the word "sentential" by "left sentential" and "right most sentential" respectively in the definition of FOLLOW(A).
Which of the following statements is/are true? (a) FOLLOW(A) and FOLLOW (A) maybe different. (b) FOLLOW(A) and FOLLOW (A) are always the same. (c) Al the three sets are identical. (d) Al the three sets are different. please explain ! Post Resume: Click here to Upload your Resume & Apply for Jobs |
|
![]() |
|
manju
Senior Member ![]() Joined: 20Feb2007 Online Status: Offline Posts: 221 |
![]() ![]() ![]() |
Consider G as
E -> +ET / T T -> *TF / F F -> (E) / id When we find FOLLOW (E) We apply rules: 1. If it is start smbl, add $ 2. If A -> (alpha) B (beta), add (FIRST of beta) - epsilon 3. If A -> (alpha) OR (alpha) B (beta) with epsilon, add FOLLOW (A) So, FOLLOW (T) = FIRST (F) = (, id......... rule 2 FOLLOW (T) = FOLLOW (E) = $ .... rule 3 Does rule 2 implies RFOLLOW, while rule 3 implies LFOLLOW?? Coz considering parse tree, rules seem to apply for Left and right sentensial. i.e. in string, like * id id..... , rule 2 gives RFOLLOW set while in strings like + id id, rule 3 gives end of string i.e. LFOLLOW set... seems confusing... still i think, whtever i wrote is somewhr related... though m nt so sure.. |
|
![]() |
|
![]() ![]() |
||
Forum Jump |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
|
© Vyom Technosoft Pvt. Ltd. All Rights Reserved.