fork download
  1. %{
  2. #include stdio.h
  3. #include string.h
  4. %}
  5.  
  6. %option noyywrap
  7.  
  8. %%
  9. [a-zA-Z_][a-zA-Z0-9_] { printf(%s = Length %dn, yytext, yyleng); }
  10. [0-9]+ { printf(%s = Length %dn, yytext, yyleng); }
  11. .n ;
  12. %%
  13.  
  14. int main() {
  15. char input = abc 123 _name var42 9999;
  16. YY_BUFFER_STATE buf = yy_scan_string(input);
  17. yylex();
  18. yy_delete_buffer(buf);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.04s 6832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/mbDWZg/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit