fork download
  1. /*lex code to determine whether input is an identifier or not*/
  2. % {
  3. #include <stdio.h>
  4. %
  5. }
  6.  
  7. / rule section % %
  8. // regex for valid identifiers
  9. ^[a - z A - Z _][a - z A - Z 0 - 9 _] * printf("Valid Identifier");
  10.  
  11. // regex for invalid identifiers
  12. ^[^a - z A - Z _] printf("Invalid Identifier");
  13. .;
  14. % %
  15.  
  16. main()
  17. {
  18. yylex();
  19. }
Success #stdin #stdout #stderr 0.02s 6968KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/35gKzI/prog:19:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit