The lexical analysis for a modern computer language like Java necessarily needs the power of which one of the following machine models?
The lexical analysis for a modern computer language like Java necessarily needs the power of which one of the following machine models? Correct Answer Finite automata
The correct answer is option 4.
Concept:
In lexical analysis, finite automata is used to produce tokens in the form of identifiers, keywords, and constants from the input program. In the process of pattern recognition, it is used to search keywords by using string-matching algorithms.
The compiler's first phase is known as lexical analysis or scanning. The lexical analyzer examines the source program's stream of characters and arranges them into meaningful sequences known as lexemes. The lexical analyzer generates tokens as output for the parser for each lexeme, and tokens are expressed in regular expressions.
So, a simple Finite Automata is sufficient for it.
Hence the correct answer is Finite automata.
Additional Information
| Compiler Phase | Machine Model Required |
| Lexical Analysis Phase | Finite Automata |
| Syntax Analysis Phase | Push Down Automata |
| Semantic Analysis Phase | Turing Machine(TM) |