fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5.  
  6. /*
  7. %option noyywrap
  8. %{
  9. #include<stdio.h>
  10.  
  11. %}
  12. letter [A-Za-z]
  13. digit [0-9]
  14. keyword "for"|"int"|"else"|"float"
  15.  
  16. id (letter)({letter}|{digit})*
  17.  
  18. %%
  19.  
  20. {digit} {printf("digit found"); //action in c
  21.  
  22. }
  23.  
  24. {id} {printf("identifier found");}
  25. {keyword} {printf("keyword found");}
  26.  
  27. {digit} {printf("<%s, digit>\n",yytext);}
  28. {keyword} {printf("<%s, keyword>\n",yytext);}
  29. {id} {printf("<%s, id>\n",yytext);}
  30.  
  31.  
  32. %%
  33. int main()
  34. {
  35. yylex();
  36. }
  37. */
  38. printf("hello");
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
hello