Compiler Design Program to Lexical Analyzer Using Lex Tool
/* program name is lexp.l */ %{ /* program to recognize a c program */ int COMMENT=0; int cnt=0; %} identifier [a-zA-Z][a-zA-Z0-9]* %% #.* { printf("\n%s is a PREPROCESSOR DIRE…