Input Buffering
The input buffering helps to find the correct lexeme; more than one character has to be seen beyond the next lexeme.
A two-buffer scheme is initiated to handle large lookaheads safely.
Techniques for speeding up the process of lexical analyzer such as the use of sentinels to mark the buffer-end have been adopted.
There are three approaches to implement the Lexical Analyzer.
- Using a Lexical analyzer generator, like a lex compiler to produce the lexical analyzer. In this, the generator gives routines for reading and buffering the input.
- By writing the lexical analyzer in a traditional systems-programming language, and by using input-output facilities of that language to read the input.
- By writing the lexical analyzer in low-level language and directly managing the reading of input.
The two buffer Schemes are:
- Buffer Pairs
- Sentinels
Reference Link
