in Compiler Design edited by
2,952 views
7 votes
7 votes

Which variable does not drive a terminal string in grammar?

  • $S \rightarrow AB$
  • $A \rightarrow a$
  • $B \rightarrow b$
  • $B \rightarrow C$
  1. A
  2. B
  3. C
  4. S
in Compiler Design edited by
3.0k views

1 comment

Options for this question are:

a . A

b. B

c. C

d. S
0
0

3 Answers

6 votes
6 votes

Here

S -> AB

{A ->a} and {B ->b or C}

if B goes with C then, there is no termination string.

So, answer is 'C' . which is also called useless symbol.

3 Comments

c or d?
0
0
yes.  C is useless symbol.

So, option D where B is deriving an un-terminated symbol.

ie. B -> C.
1
1

Options for this question are:

a . A

b. B

c. C

d. S

0
0
1 vote
1 vote

C is the variable which do not derive any terminal, its also called useless symbol,

after reducing useless variables your remaining grammar is,

S--> AB,  A-->a , B-->b

also see this

edited by

2 Comments

why you deleted production B->b here?
0
0
you are right, i corrected it
0
0
0 votes
0 votes
its simple as C is unreachable it cannot derive any string
Answer:

Related questions