fork download
  1. %{
  2. #include <stdio.h> #include <string.h>
  3. %}
  4. %option noyywrap
  5. %%
  6. "int"|"float"|"char"|"if"|"else"|"while"|"for"|"return" { printf("Keyword: %s\n", yytext); }
  7. [0-9]+ {
  8. printf("Constant: %s\n", yytext); }
  9. [a-zA-Z_][a-zA-Z0-9_]* { printf("Identifier: %s\n", yytext); }
  10. . {
  11.  
  12. printf("Special Character: %s\n", yytext); }
  13. %%
  14. int main() {
  15. printf (“Krischal Dhakal, Symbol no:28672\n”);
  16. printf("Enter your code: (Press ctrl + C to end input)\n"); yylex();
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.02s 7016KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/GIQPyH/prog:2:1: Syntax error: Operator expected
ERROR: /home/GIQPyH/prog:18:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit