fork download
  1. %{
  2. #include <stdio.h>
  3. #include <string.h>
  4. %}
  5.  
  6. %%
  7.  
  8. [0-9]+ { printf("Number: %s, Length: %d\n", yytext, yyleng); }
  9. [a-zA-Z]+ { printf("Word: %s, Length: %d\n", yytext, yyleng); }
  10. [ \t\n]+ ; // Ignore whitespace characters
  11.  
  12. %%
  13.  
  14. int main() {
  15. yylex();
  16. return 0;
  17. }
  18.  
  19. int yywrap() {
  20. return 1;
  21. }
  22.  
Success #stdin #stdout #stderr 0.04s 6956KB
stdin
1
2
10
42
11
stdout
Standard output is empty
stderr
ERROR: /home/gWgSYh/prog:21:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit