Computer Science EngineeringHard
When several lexemes could be matched by different Lex rules, Lex picks
- A. the longest match, and the earlier rule on a tie
- B. the shortest match
- C. a random rule
- D. the last rule listed
Correct answer: A. the longest match, and the earlier rule on a tie
Lex uses the longest-match principle and breaks ties by rule order.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- The language {a^n b^m | n != m} is
- The language denoted by the regular expression empty-set star (the Kleene star of the empty set) is
- The minimal DFA over {a, b} accepting strings whose length is divisible by 3 has how many states?
- Adding extra tapes to a Turing machine
- Savitch's theorem implies that
- If any NP-complete problem is shown to have a polynomial-time algorithm, then