Lex program to Describe the present operators in a arithmetic statement.
Note: only +,-,/,* Supported.
Program:
%option noyywrap %{ %} %% "=" {printf("\n operator is Equal");} "+" {printf("\n Operator is Plus");} "-" {printf("\n Operator is minus");} "/" {printf("\n Operator is Division");} "*" {printf("\n Opertor is multiplication");} [a-zA-z]*[0-9]* { printf("\n Identifier is %s",yytext);} . return yytext[0]; \n return 0; %% main() { yylex(); }
Comments
Post a Comment