fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. DIGIT [0-9]
  6. EXPONENT [eE][+-]?{DIGIT}+
  7.  
  8. %%
  9. {DIGIT}+"."{DIGIT}*{EXPONENT}? { printf("Floating Point Number: %s\n", yytext); }
  10. {DIGIT}+{EXPONENT} { printf("Floating Point Number: %s\n", yytext); }
  11. {DIGIT}+ { printf("Integer: %s\n", yytext); }
  12. [ \t\n] ; // Ignore whitespaces and newlines
  13. . { printf("Invalid: %s\n", yytext); }
  14.  
  15. %%
  16.  
  17. int main() {
  18. yylex();
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6812KB
stdin
11111
stdout
Standard output is empty
stderr
ERROR: /home/0Pp2FI/prog:2:1: Syntax error: Operator expected
ERROR: /home/0Pp2FI/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit