in Compiler Design edited by
5,666 views
6 votes
6 votes

A particular BNF definition for a "word is given by the following rules.

<word>      :: = <letter> I <letter> <charpair> I <letter> <intpair>
<charpair>  :: = <letter> <letter> I <charpair> <letter> <letter>
<intpair>   :: = <integer> <integer> I <intpair> <integer> <integer>
<letter>    :: = a I b I c I ......I Y I Z
<integer>   :: = 0 I 1 I 2 I ......I 9

Which of the following lexical entries can be derived from $\textsf{< word >}?$

  1. pick
  2. picks
  3. $\textsf{c44}$
  1. I, II and III
  2. I and II only
  3. I and III only
  4. II and III only
in Compiler Design edited by
by
5.7k views

1 comment

The grammar is generating strings of odd length ... So option a can be eliminated in first place..
0
0

3 Answers

5 votes
5 votes
Best answer

option d

selected by
1 vote
1 vote
pick can't be generated other are generated hence ans should be B

2 Comments

yes pick can't be generated.So D is correct choice.isn't it?
0
0
yes option D is correct answer.
0
0
1 vote
1 vote
Ans: D.

What I thought, "word" is having only 4 char. Which can't be derived from the grammar.

"words" is having 5 char, which is odd, so can be derived from the grammar.

Also c22 can be drived.

So ans is II and III, implies option D.

1 comment

Can you please explain the procedure to solve this type of problem?

1
1
Answer:

Related questions