fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4. %%
  5. [0-9]+[.][0-9]+ printf("%s is a floating point number\n",yytext);
  6. int|float|char|double|void printf("%s is a datatype\n",yytext); [0-9]+
  7. printf("%s is an integer number\n",yytext);
  8. [a-z]+[()] printf("%s is a function\n",yytext);
  9. [a-z]+ printf("%s is an identifier\n",yytext);
  10. [+=*/-] printf("%s is an operator\n",yytext);
  11. ; printf("%s is an delimiter\n",yytext);
  12. , printf("%s is a separator\n",yytext);
  13. [#][a-z\.h]+ printf("%s is a preprocessor\n",yytext);
  14. %% int yywrap(void)
  15. { return 1; }
  16. int main(void) {
  17. yylex();
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.02s 6904KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/utrJwv/prog:19:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit