Lexical-Analyzer

Question 1
A particular BNF definition for a “word” is given by the following rules.
<word> ::= <letter> | <letter><pairlet> | <letter><pairdig>
<pairlet> ::= <letter><letter> | <pairlet><letter><letter>
<pairdig> ::= <digit><digit> | <pairdig><digit><digit>
<letter> ::= a | b | c | ... | y | | z
<digit> ::= 0 | 1 | 2 | ... | 9
Which of the following lexical entries can be derived from < word > ?
I. pick
II. picks
III. c44
A
I, II and III
B
I and II only
C
l and III only
D
lI and III only
Question 1 Explanation: 
Step-1: Both < letter > and < digit > produce only a single character
Step-2: Both < pairlet > and < pairdig > produce even number of characters
Step-3: < word > produces odd number of characters.
Step-4: As per the statements I, II and III. I statement having even number of characters
So, a statement I is wrong. Statement II and III are having odd number of characters.
There is 1 question to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access