fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. /* Definitions */
  6. VOWEL [aeiouAEIOU]
  7. INTEGER [0-9]+
  8. VERB [a-zA-Z]+ing
  9.  
  10. %%
  11.  
  12. {VOWEL} { printf("Vowel: %s\n", yytext); }
  13.  
  14. {INTEGER} { printf("Integer: %s\n", yytext); }
  15.  
  16. {VERB} { printf("Verb: %s\n", yytext); }
  17.  
  18. [ \t\n]+ ; /* Ignore whitespace */
  19.  
  20. . { printf("Unknown: %s\n", yytext); }
  21.  
  22. %%
  23.  
  24. int main() {
  25. yylex();
  26. return 0;
  27. }
  28.  
  29. int yywrap() {
  30. return 1;
  31. }
  32.  
Success #stdin #stdout #stderr 0.03s 6860KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/jUI0n8/prog:2:1: Syntax error: Operator expected
ERROR: /home/jUI0n8/prog:31:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit