fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. "/*"([^*]|\*+[^/])*\*/ ; // Ignore block comments
  8. [ \t\n]+ ; // Ignore whitespace
  9. "int"[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)([ \t]*,[ \t]*[a-zA-Z_][a-zA-Z0-9_]*)*[ \t]*";" {
  10. printf("Found int declaration: %s\n", yytext);
  11. }
  12. . ECHO; // Echo everything else
  13.  
  14. %%
  15.  
  16. int main(void) {
  17. yylex();
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.03s 6944KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/fTn4Yg/prog:2:1: Syntax error: Operator expected
ERROR: /home/fTn4Yg/prog:19:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit