fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5.  
  6.  
  7. %%
  8. [A-Z]{5}[0-9]{4}[A-Z] { printf("Valid PAN Number: %s\n", yytext); }
  9. [0-9]{12} { printf("Valid Aadhaar Number: %s\n", yytext); }
  10. [A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{4} { printf("Valid Vehicle Number: %s\n", yytext); }
  11. [ \t\n]+ { /* Ignore whitespace */ }
  12. . { printf("Invalid Token: %s\n", yytext); }
  13. %%
  14.  
  15. int main(int argc, char **argv)
  16. {
  17. printf("Enter input strings (Ctrl+D to stop):\n");
  18. yylex();
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6948KB
stdin
123456789102
stdout
Standard output is empty
stderr
ERROR: /home/0DIrra/prog:2:1: Syntax error: Operator expected
ERROR: /home/0DIrra/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit