fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4. %%
  5. "if"{printf("IF");}
  6. "else"{printf("ELSE");}
  7. "then"{printf("THEN");}
  8. "while"{printf("WHILE");}
  9. "<"|">"{printf("RELOP");}
  10. [a-zA-Z][a-z|0-9]*{printf("identifier");}
  11. "("|")"{printf("Bracket");}
  12. [0-9]*{printf("NUM");}
  13. %%
  14. int yywrap()
  15. {
  16. return 1;
  17. }
  18. main(){
  19. printf("enter your string: ");
  20. yylex();
  21. }
Success #stdin #stdout #stderr 0.02s 6868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/f3SXxH/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit