fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4.  
  5. %%
  6. [-+*/()] {
  7. printf("Entered character is an operator\n");
  8. }
  9. . {
  10. printf("Entered character is not an operator\n");
  11. }
  12. %%
  13.  
  14. int main()
  15. {
  16. char a;
  17. printf("Enter a character- ");
  18. scanf("%c",&a);
  19. yy_scan_string(&a);
  20. yylex();
  21. return 0;
  22. }
Success #stdin #stdout #stderr 0.02s 6920KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/uu2t1X/prog:2:1: Syntax error: Operator expected
ERROR: /home/uu2t1X/prog:22:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit