fork download
  1. %{
  2. #include <stdio.h>
  3. int financial_count = 0;
  4. %}
  5.  
  6. %%
  7. finance|money|investment|stock|market|economy|profit|loss|revenue|asset|liability|income|expense|balance|credit|debit|transaction|cash|account|bank|loan|currency|budget { financial_count++; }
  8. . ; /* ignore all other characters */
  9.  
  10. %%
  11.  
  12. int main(int argc, char *argv[]) {
  13. yyin = fopen(argv[1], "r");
  14. yylex();
  15. printf("Financial keyword count: %d\n", financial_count);
  16. if (financial_count >= 5) {
  17. printf("The document is likely financial.\n");
  18. } else {
  19. printf("The document is not likely financial.\n");
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout #stderr 0.03s 6888KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/6bdKF0/prog:2:1: Syntax error: Operator expected
ERROR: /home/6bdKF0/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit