Lexical Analysis questions

Q35

GATE CS 2026 CS-2Lexical AnalysisNAT1 mark
A lexical analyzer uses the following token definitions
* letter→[A−Za−z]letter \rightarrow [A - Za - z]
* digit→[0−9]digit \rightarrow [0 - 9]
* id→letter(letter∣digit)∗id \rightarrow letter (letter \mid digit)^*
* number→digit+number \rightarrow digit^+
* ws→(blank∣tab∣newline)+ws \rightarrow (blank \mid tab \mid newline)^+

For the string given below,

x1  23mm  78  y  7z  zz5  14A  8H  AaYcDx1 \; 23mm \; 78 \; y \; 7z \; zz5 \; 14A \; 8H \; AaYcD

the number of tokens (excluding wsws) that will be produced by the lexical analyzer is __________. (answer in integer)
Show answer without attempting

Answer: 13

0/10 correct0 marks

Related topics in Compiler Design