Professional Documents
Culture Documents
Corrige Flex
Corrige Flex
%%
"Program"|"Var"|"Int"|"Function"|"Begin"|"If"|"Then"|"Return"|"Else"|"End" printf("%s
:Keyword\n",yytext);
[a-zA-Z][a-zA-Z0-9]* printf("%s : ID\n",yytext);
\: printf("%s : TP\n", yytext);
\( printf("%s : PO\n", yytext);
\) printf("%s : PF\n", yytext);
\= printf("%s :EQ\n", yytext);
[0-9]+ printf("%s :Integer\n", yytext);
":=" printf("%s : Assign\n",yytext);
\; printf("%s : Semicolon\n",yytext);
\- printf("%s : Minus\n", yytext);
\+ printf("%s : Plus\n",yytext);
\, printf("%s : Comma\n", yytext);
\. printf("%s : Point\n",yytext);
%%
int main()
{
yylex();
return(0);
}
int yywrap()
{
return(1);
}
-1-