What type of grammar is accepted by LEX for token recognition?
2025
What type of grammar is accepted by LEX for token recognition?
- A.
Unrestricted grammar
- B.
Regular grammar
- C.
Context-free grammar
- D.
Context-sensitive grammar
Attempted by 44 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.