fork download
  1. /*Definition Section*/
  2. %{
  3. #include<stdio.h>
  4. %}
  5.  
  6.  
  7. /*Rule Section*/
  8. %%
  9.  
  10. /*put all words in a single line, which are broken in 4 lines*.
  11. auto|double|int|struct|break|else|long|switch|case|
  12. enum|register|typedef|char|extern|return|union|continue
  13. |for|signed|void|do|if|static|while|default|goto|sizeof
  14. |volatile|const|float|short|unsigned;
  15.  
  16. /*Check the token, if token is match with
  17. pattern then it will print identifier.*/
  18. ([a-zA-Z][0-9])+|[a-zA-Z]* {printf("Identifier\n");}
  19.  
  20. ^[0-9]+ {printf("Not a Identifier\n");}
  21.  
  22. .|\n;
  23. %%
  24.  
  25. /*call the yywrap function*/
  26. int yywrap()
  27. {
  28. return 1;
  29. }
  30.  
  31. /*Auxiliary function*/
  32. /*Driver function*/
  33. int main(void)
  34. {
  35. /*call the yylex function.*/
  36. yylex();
  37. return 0;
  38. }
  39.  
Success #stdin #stdout #stderr 0.03s 6772KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/icVxz2/prog:3:1: Syntax error: End of file in /* ... */ comment
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit