fork download
  1. %option noyywrap
  2.  
  3. %%
  4.  
  5. [0-9][a-zA-Z0-9_]+ { printf("Invalid Identifier: %s (cannot start with digit)\n", yytext); }
  6.  
  7. [@#$%^&*\-+][a-zA-Z0-9_]* { printf("Invalid Identifier: %s (cannot start with special character)\n", yytext); }
  8.  
  9. [ \t\n]+ ;
  10.  
  11. %%
  12.  
  13. int main() {
  14. printf("Enter input:\n");
  15. yylex();
  16. return 0;
  17. }
Success #stdin #stdout #stderr 0.02s 6928KB
stdin
_hello
123hello
hello$
stdout
Standard output is empty
stderr
ERROR: /home/0NQd53/prog:17:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? Options:
+:                  spy        -:              no spy
/c|e|r|f|u|a goal:  find       .:              repeat find
a:                  abort      A:              alternatives
b:                  break      c (ret, space): creep
[depth] d:          depth      e:              exit
f:                  fail       [ndepth] g:     goals (backtrace)
h (?):              help       i:              ignore
l:                  leap       L:              listing
n:                  no debug   p:              print
r:                  retry      s:              skip
u:                  up         w:              write
m:                  exception details
C:                  toggle show context
   Exception: (3) program ? EOF: exit