fork download
  1. %{
  2. #include<stdio.h>
  3. #include<ctype.h>
  4.  
  5. int a=0;
  6. %}
  7. %%
  8.  
  9. [a-zA-Z_][a-zA-Z0-9_]* {
  10. printf("Valid identifier : %s\n",yytext);
  11. a++;
  12. }
  13. "=" {printf ("Assignment operator found \n");}
  14. . {printf ("invalid character :%s\n",yytext);}
  15. %%
  16. int main(){
  17. yylex();
  18. printf("Total valid identifiers found :%d\n",a);
  19. return 0;
  20. }
  21.  
  22. int yywrap(void){
  23. return 1;
  24. }
Success #stdin #stdout #stderr 0.03s 6900KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/rFd9WJ/prog:2:2: Syntax error: Operator expected
ERROR: /home/rFd9WJ/prog:24:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit