The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+9 votes
1.2k views

Consider the following grammar:

$S\rightarrow FR$

$ R\rightarrow * S\mid \varepsilon $

$ F\rightarrow  id $

In the predictive parser table, M, of the grammar the entries M[S,id] and M[R,\$] respectively are

  1. $ \left \{ S\rightarrow FR \right \} $ and $ \left \{ R\rightarrow \varepsilon \right \} $
  2. $ \left \{ S\rightarrow FR \right \} $ and $ \left \{ \right \} $
  3. $ \left \{ S\rightarrow FR \right \} $ and $ \left \{ R\rightarrow {*}S\right \} $
  4. $ \left \{ F\rightarrow id \right \} $ and $ \left \{ R\rightarrow \varepsilon \right \} $
asked in Compiler Design by Active (3.7k points)
edited by | 1.2k views

3 Answers

+17 votes
Best answer

First $S = \{ id \}$
Follow $R = \{ \$ \}$

so $M[S,id] = S  \rightarrow FR$
     $M[S,\$] = R  \rightarrow \epsilon$

So ans is A

answered by Boss (31.4k points)
edited by
0
What is the Follow of S R F ?
Please explain how to find follow in this example
+5
pls correct me  if wrong

        First              Follow

S       id                      \$

R      * , ε                   \$

F      id                     * $
+1
yes your first and follows are correct.
+1 vote

Answer:

answered by Junior (559 points)
0 votes
ans a)
answered by Active (5.2k points)
+12
Please try to include an explanation with your answer. Unless you provide an explanation, your answer is mostly useless.
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

37,939 questions
45,453 answers
131,195 comments
48,209 users