fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. int|float|void|for|if|else
  8. {
  9. printf("\n %s the token recognized is Keyword",yytext);
  10. }
  11.  
  12. [,;]
  13. {
  14. printf("\n %s the token is recognized is delimiter",yytext);
  15. }
  16.  
  17. [a-zA-Z_][a-zA-Z_0-9]*
  18. {
  19. printf("\n %s the token recognized is Identifier",yytext);
  20. }
  21.  
  22. [+\-*/><>=<=]
  23. {
  24. printf("\n %s the token recognized is operator",yytext);
  25. }
  26.  
  27. [0-9]+
  28. {
  29. printf("\n %s the token recognized is constant",yytext);
  30. }
  31.  
  32. [,;:\[\]\{\}\(\)\#\.]
  33. {
  34. printf("\n %s the token recognized is special symbol",yytext);
  35. }
  36.  
  37. %%
  38.  
  39. int main()
  40. {
  41. yylex();
  42. return 0;
  43. }
  44.  
Success #stdin #stdout #stderr 0.02s 6944KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/WUdhe2/prog:43:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit