fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4. %%
  5. 0[xX][0-9a-fA-F]+ { printf("%s is a hexadecimal number\n", yytext); }
  6. 0[0-7]+ { printf("%s is an octal number\n", yytext); }
  7. [1-9][0-9]* { printf("%s is a decimal number\n", yytext); }
  8. 0 { printf("0 is considered as zero\n"); }
  9. . { printf("Invalid input: %s\n", yytext); }
  10. %%
  11.  
  12. int main() {
  13. yylex();
  14. return 0;
  15. }
  16.  
  17.  
Success #stdin #stdout #stderr 0.02s 6992KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/wINj9z/prog:2:1: Syntax error: Operator expected
ERROR: /home/wINj9z/prog:16:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit