fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4. %%
  5. int | float | char {printf("%s is a Keyword", yytext);}
  6. [0-9]+ {printf("%s is a Number", yytext);}
  7. [a-zA-Z][a-zA-Z|0-9]* {printf("%s is an Identifier", yytext);}
  8. [+ | - | * | /] {printf("%s is a Operator", yytext);}
  9. [@|#|$|&] {printf("%s is a Special Symbol", yytext);}
  10. . | \n {ECHO;}
  11. %%
  12. int main()
  13. {
  14. printf("Please enter the string..!");
  15. yylex();
  16. }
  17. int yywrap()
  18. {
  19. return 1;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6800KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/wSIsWd/prog:2:9: Syntax error: Operator expected
ERROR: /home/wSIsWd/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit