fork download
  1. // ********* LEX Program to identify Mini language Tokens *****************//
  2. DIGIT [0-9]
  3. LETTER [A-Z a-z]
  4. DELIM [ \t\n]
  5. WS { DELIM }+
  6. ID {(LETTER)[LETTER/DIGIT]}+
  7. INTEGER {DIGIT}+
  8. %%
  9. {WS} { printf("\n WS special characters \n"); }
  10. {ID} { printf("\n Identifiers \n"); }
  11. {DIGIT} {printf("\n Intgers\n"); }
  12. if { printf("\n Keywords\n"); }
  13. else { printf("\n keywords\n"); }
  14. ">" { printf("\n Relational Operators\n"); }
  15. "<" { printf("\n Relational Operators \n"); }
  16. "<=" { printf("\n Relational Operators \n"); }
  17. "=>" { printf("\n Relational Operators \n"); }
  18. "=" { printf("\n Relational Operators \n"); }
  19. "!=" { printf("\n Logical Operators \n"); }
  20. "&&" { printf("\n Logical Operators \n"); }
  21. "||" { printf("\n Logical Operators \n"); }
  22. "!" { printf("\n Logical Operators \n"); }
  23. "+" { printf("\n Arthmetic Operator\n"); }
  24. "-" { printf("\n Arthmetic Operator\n"); }
  25. "*" { printf("\n Arthmetic Operator\n"); }
  26. "/" { printf("\n Arthmetic Operator\n"); }
  27. "%" { printf("\n Arthmetic Operator\n"); }
  28. %%
  29. int yywrap(){ }
  30. int main()
  31. {
  32. Printf(‘’ Enger the text : ’’)
  33. yylex();
  34. return 0 ;
  35. }
Success #stdin #stdout #stderr 0.02s 6924KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/Ygfqzr/prog:35:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit