/Lex

Primary LanguageC

Lex

Lex/Flex - Write the code to recognize the following tokens.

• Constants - Integer and Float.

• Keywords - while, if, for, int, float, char, main, printf, scanf, break, do, typedef, static.

• Identifiers - It can have alpha (lowercase) numeric combination, start with alphabet or underscore and only first 20 characters to be picked and remaining to be dropped.

• Logical operators - &&, ||, !.

• Arithmetic operators - +, −, /, ∗.

• Relational operators - >, >=, <, <=, ! =.

• Unary Operators - −−, ++, ∗.