fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %option noyywrap
  6.  
  7.  
  8. NOUN destiny|Destiny
  9. PRONOUN it|It
  10. VERB run|Run|arrives|Arrives|Dread|dread
  11. ADJECTIVE same|Same
  12. ADVERB from|From
  13. DETERMINERS the|The|all|All
  14. PUNCTUATIONS [\.\,\?\!]
  15.  
  16. %%
  17.  
  18. {NOUN} {printf("%s -> NOUN\n",yytext); }
  19. {PRONOUN} {printf("%s -> PRONOUN\n",yytext); }
  20. {VERB} {printf("%s -> VERB\n",yytext); }
  21. {ADVERB} {printf("%s -> ADVERB\n",yytext); }
  22. {ADJECTIVE} {printf("%s -> ADJECTIVE\n",yytext); }
  23. {DETERMINERS} {printf("%s -> DETERMINERS\n",yytext); }
  24. {PUNCTUATIONS} {printf("%s -> PUNCTUATIONS\n",yytext); }
  25. [ \t\n]+ ;
  26. . {printf("%s -> UNKNOWN\n",yytext); }
  27.  
  28. %%
  29.  
  30. int main(){
  31. yylex();
  32. return 0;
  33. }
  34.  
Success #stdin #stdout #stderr 0.03s 6876KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/WiVenP/prog:2:5: Syntax error: Operator expected
ERROR: /home/WiVenP/prog:33:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit