fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. [A-Z]+ { printf("Capital Word: %s\n", yytext); }
  8. \n ; // Ignore newlines
  9. . ; // Ignore all other characters
  10.  
  11. %%
  12.  
  13. int main() {
  14. printf("Enter a string: ");
  15. yylex(); // Invoke the lexical analyzer
  16. return 0;
  17. }
  18.  
  19. int yywrap() {
  20. return 1;
  21. }
  22.  
Success #stdin #stdout #stderr 0.02s 7012KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/vOk3Ct/prog:2:1: Syntax error: Operator expected
ERROR: /home/vOk3Ct/prog:21:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit