fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. DIGIT [0-9]
  6.  
  7. %%
  8. {DIGIT}+ { printf("Number: %s, Length: %d\n", yytext, yyleng); }
  9. . { printf("Other: %s\n", yytext); }
  10. %%
  11.  
  12. int main() {
  13. printf("Enter your input: \n");
  14. yylex(); // Start lexical analysis
  15. return 0;
  16. }
  17.  
  18. int yywrap() {
  19. return 1;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6808KB
stdin
123 abc + 456 def -
stdout
Standard output is empty
stderr
ERROR: /home/F36EqZ/prog:2:1: Syntax error: Operator expected
ERROR: /home/F36EqZ/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit