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