What type of grammar is accepted by LEX for token recognition?
2025
What type of grammar is accepted by LEX for token recognition?
Answer: B. Regular grammar — LEX is a tool used for lexical analysis and token recognition in compiler design. LEX recognizes tokens using regular expressions, which are based on regular…
- A.
Unrestricted grammar
- B.
Regular grammar
- C.
Context-free grammar
- D.
Context-sensitive grammar
Attempted by 215 students.
Show answer & explanation
Correct answer: B
LEX is a tool used for lexical analysis and token recognition in compiler design. LEX recognizes tokens using regular expressions, which are based on regular grammar. These grammars are suitable for defining patterns such as identifiers, keywords, operators, and numbers.
Loading lesson…