fork download
  1. %{
  2. #include<stdio.h>
  3. int flag=0;
  4. %}
  5.  
  6. %%
  7. and |
  8. or |
  9. but |
  10. because |
  11. if |
  12. then |
  13. nevertheless { flag=1; }
  14. . ;
  15. \n { return 0; }
  16. %%
  17.  
  18. int main()
  19. {
  20. printf("Enter the sentence:\n");
  21. yylex();
  22. if(flag==0)
  23. printf("Simple sentence\n");
  24. else
  25. printf("compound sentence\n");
  26. }
  27.  
  28. int yywrap( )
  29. {
  30. return 1;
  31. }
Success #stdin #stdout #stderr 0.02s 6800KB
stdin
i m abc and def
stdout
Standard output is empty
stderr
ERROR: /home/ok2lJL/prog:2:9: Syntax error: Operator expected
ERROR: /home/ok2lJL/prog:31:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Can't ignore goal at this port
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit