fork download
  1. %option noyywrap
  2. %{
  3. // no C code is placed here
  4. %}
  5.  
  6. ws [ \t\n]+
  7. digit [0-9]
  8. octalnum 0[0-7]+
  9. number {digit}+
  10. delimiter ,|;
  11. %%
  12. {ws} {;}
  13. {octalnum} {printf(" (Token, Lexeme) = (OCTAL NUMBER, %s)\n", yytext); return (3);}
  14. {number} {printf(" (Token, Lexeme) = (DECIMAL NUMBER, %s)\n", yytext); return (2);}
  15. {delimiter} {printf(" (Token, Lexeme) = (DELIMITER, '%s')\n", yytext); return (5);}
  16. %%
  17. int main()
  18. {
  19. printf("");
  20. while(yylex());
  21. return 0;
  22. }
  23.  
Success #stdin #stdout #stderr 0.02s 6884KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/bLVqr6/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit