1.

The lexical analysis for a modern language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?(a) Finite state automata(b) Deterministic pushdown automata(c) Non-deterministic pushdown automata(d) Turing machineThe question was posed to me during an online interview.I'd like to ask this question from Transformation from NFA to DFA in section Finite Automata and Regular Expression of Compiler

Answer» CORRECT answer is (a) Finite state automata

Explanation: Initially in LEXICAL ANALYSIS the program is divided into tokens. Tokens can be EXPRESSED as regular expressions: [a-zA-Z] [a-zA-Z0-9]*

the KEYWORD if is given by if.

Integers are given by [+-]? [0-9]+.


Discussion

No Comment Found

Related InterviewSolutions