fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. "if" *"(".*")" *"{" { printf("Valid 'if' syntax\n"); }
  7. "else if" *"(".*")" *"{" { printf("Valid 'else if' syntax\n"); }
  8. "else" *"{" { printf("Valid 'else' syntax\n"); }
  9.  
  10. "switch" *"(".*")" *"{" { printf("Valid 'switch' syntax\n"); }
  11. "case" .*":" { printf("Valid 'case' syntax\n"); }
  12. "default" *":" { printf("Valid 'default' syntax\n"); }
  13. . { /* Ignore other characters */ }
  14. %%
  15.  
  16. int main() {
  17. yylex();
  18. return 0;
  19. }
  20.  
  21. int yywrap() {
  22. return 1;
  23. }
Success #stdin #stdout #stderr 0.04s 6944KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/aSdH3g/prog:2:1: Syntax error: Operator expected
ERROR: /home/aSdH3g/prog:23:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit