-
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
-
- Finite state automata
- Deterministic push down automata
- Non-deterministic push down automata
- Turing machine
- Finite state automata
Correct Option: A
Lexical analysis is the first step in compilation. In lexical analysis, program is divided into tokens. Lexical analyzers are typically based on finite state automata. Tokens can typically be expressed as different regular expressions: An identifier is given by [a-zA-Z][a-zA-Z0-9]*
The keyword if is given by if. Integers are given by [+-]?[0-9]+.