fork download
  1. %{
  2.  
  3. #include <stdio.h>
  4.  
  5. #define COMM_L 257
  6. #define COMM_T 258
  7. #define STRING 259
  8.  
  9. %}
  10.  
  11. %x COMMENT
  12.  
  13. %%
  14.  
  15. \"(\\.|[^\"])*\" { return STRING;}
  16. \/\/[^\n]* { return COMM_L;}
  17. "/*" { BEGIN( COMMENT); yymore();}
  18. <COMMENT>.|\n { yymore();}
  19. <COMMENT>"*/" { BEGIN( INITIAL); return COMM_T;}
  20.  
  21. %%
  22.  
  23. int yywrap( void){ return 1;}
  24.  
  25. int main( int argc,char **argv)
  26. {
  27. int tokentype;
  28. while( tokentype = yylex()){
  29. printf("%d %s\n",tokentype,yytext);
  30. }
  31. return 0;
  32. }
  33.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty