fork descargar
  1. %{
  2. #include <stdio.h>
  3. int lines = 0, spaces = 0, tabs = 0, chars = 0;
  4. %}
  5.  
  6. %%
  7. " " { spaces++; }
  8. "\t" { tabs++; }
  9. "\n" { lines++; }
  10. . { chars++; }
  11. %%
  12.  
  13. int main()
  14. {
  15. printf("Enter the text\n");
  16. yylex();
  17.  
  18. printf("Lines : %d\nSpaces : %d\nTabs : %d\nChars : %d\n", lines, spaces, tabs, chars);
  19.  
  20. return 0;
  21. }
  22.  
  23. int yywrap()
  24. {
  25. return 1;
  26. }
  27.  
  28.  
  29.  
Éxito #stdin #stdout #stderr 0.03s 6872KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/WLnO9d/prog:2:1: Syntax error: Operator expected
ERROR: /home/WLnO9d/prog:28:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit