Consider the following statements related to compiler construction : I.…

2017

Consider the following statements related to compiler construction :

I. Lexical Analysis is specified by context-free grammars and implemented by pushdown automata.

II. Syntax Analysis is specified by regular expressions and implemented by finite-state machine.

Which of the above statement(s) is/are correct ?

  1. A.

    Only I

  2. B.

    Only II

  3. C.

    Both I and II

  4. D.

    Neither I nor II

Attempted by 265 students.

Show answer & explanation

Correct answer: D

Answer: Neither I nor II.

Explanation:

  • Lexical analysis: specified by regular expressions and implemented by finite automata (typically DFAs obtained from regex → NFA → DFA). Lexical analyzers (scanners) are generated by tools like lex/flex.

  • Syntax analysis: specified by context-free grammars and implemented by pushdown automata (parsers). Parsers for CFGs are built using techniques like top-down (recursive-descent, LL) or bottom-up (LR) parsing.

Because each given statement swapped these associations, neither statement is correct.

Explore the full course: Mppsc Assistant Professor