GATE CS 2018 (Forenoon) — Question 47

Compiler DesignLexical Analysis & Parsing Architectures (LL(1), LR(1), LALR)MCQ2 marks · −2/3 if wrongMedium

A lexical analyzer uses the following patterns to recognize three tokens \(T_1, T_2\), and \(T_3\) over the alphabet \(\{a,b,c\}\). \(T_1: a? (b|c)^* a\) \(T_2: b? (a|c)^* b\) \(T_3: c? (b|a)^* c\) Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string \(bbaacabc\) is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
  1. A
    \(T_1 T_2 T_3\)
  2. B
    \(T_1 T_1 T_3\)
  3. C
    \(T_2 T_1 T_3\)
  4. D
    \(T_3 T_3\)
Practise the full 2018-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on Lexical Analysis & Parsing Architectures (LL(1), LR(1), LALR)Timed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group