fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. int|float|char|double|short|long|unsigned|signed|void|auto|const|extern|static|register|volatile { printf("KEYWORD: %s\n", yytext); }
  8. [a-zA-Z][a-zA-Z0-9]* { printf("IDENTIFIER: %s\n", yytext); }
  9. [ \t]+ { printf("WHITESPACE: \"%s\"\n", yytext); }
  10. \n { printf("NEWLINE\n"); }
  11. . { printf("CHARACTER: %c\n", yytext[0]); }
  12.  
  13. %%
  14. int yywrap() {
  15. return 1;
  16. }
  17. int main() {
  18. yylex();
  19. return 0;
  20. }
  21.  
  22.  
Success #stdin #stdout #stderr 0.02s 7020KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/2aC9IH/prog:2:1: Syntax error: Operator expected
ERROR: /home/2aC9IH/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit