MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Amount of lookahead is limited in
A
Sentinel
B
Buffer pair
C
Lexeme
D
token
Explanation: 

Detailed explanation-1: -The amount of lookahead is limited. The limited lookahead may make it difficult to identify tokens in circumstances where the length that the forward pointer must travel is more than the length of the buffer.

Detailed explanation-2: -the only problem with this method is that if length of the lexeme is longer than length of the buffer then scanning input cannot be scanned completely. Initially both the bp and fp are pointing to the first character of first buffer.

Detailed explanation-3: -Buffer Pairs − A specialized buffering technique can decrease the amount of overhead, which is needed to process an input character in transferring characters. It includes two buffers, each includes N-character size which is reloaded alternatively.

Detailed explanation-4: -One Buffer Scheme: In this scheme, only one buffer is used to store the input string. But the problem with this scheme is that if lexeme is very long then it crosses the buffer boundary, to scan rest of the lexeme the buffer has to be refilled, that makes overwriting the first part of lexeme.

Detailed explanation-5: -The Lookahead operator is the addition operator read by lex to distinguish different patterns for a token. A lexical analyzer is used to read one character ahead of a valid lexeme and then retracts to produce a token.

There is 1 question to complete.