fork download
  1. %option noyywrap
  2. %{
  3. #include <stdio.h>
  4. %}
  5.  
  6. %%
  7.  
  8. "int"|"float"|"return"|"if"|"else"|"while"|"for"|"do"|"switch"|"case" {
  9. printf("Keyword: %s\n", yytext);
  10. }
  11.  
  12. . ; // Ignore other characters
  13.  
  14. %%
  15.  
  16. int main() {
  17. printf("Enter some expression: \n");
  18. yylex();
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/yInfBE/prog:3:3: Syntax error: Operator expected
ERROR: /home/yInfBE/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit