Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
 One Stop GATE ForumGATE Technical DiscussionsGATE CS
Message Icon Topic: Q on CC Post Reply Post New Topic
Author Message
balu
Senior Member
Senior Member


Joined: 20Feb2007
Online Status: Offline
Posts: 236
Quote balu Replybullet Topic: Q on CC
    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

IP IP Logged
manju
Senior Member
Senior Member


Joined: 20Feb2007
Online Status: Offline
Posts: 221
Quote manju Replybullet Posted: 22Feb2007 at 2:24pm
 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..
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

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

GET LATEST FRESHERS JOBS IN YOUR MAIL





This page was generated in 0.094 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Job Interview Questions | Girls Magazine | DLL, OCX File Errors | Freshers Jobs | Placement Papers | More Papers