GATE Computer ScienceModerateGATE CSE · NIELIT

A C lexer applies the maximal-munch rule (always take the longest possible token). How many tokens does it produce for the input x=a---b<<=c++>=d; ?

  1. A. 12
  2. B. 11
  3. C. 13
  4. D. 14

Correct answer: A. 12

Tokens: x = a -- - b <<= c ++ >= d ; — "---" splits as "--" "-", "<<=" is one token, and "c++>=d" gives c, ++, >=, d; total 12.

More Compiler Design questions

Exams that ask this topic