fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. "//".* { /* skip single-line comment */ }
  8. "/*"([^*]*|\*+[^*/])*"*"+"/" { /* skip multi-line comment */ }
  9.  
  10. [ \t\n]+ { /* skip whitespace */ }
  11.  
  12. . { putchar(yytext[0]); }
  13.  
  14. %%
  15.  
  16. int main(void) {
  17. yylex(); // Start scanning input from stdin
  18. return 0;
  19. }
  20.  
  21. int yywrap() {
  22. return 1;
  23. }
  24.  
Success #stdin #stdout #stderr 0.02s 6840KB
stdin
Int main
//Hello
stdout
Standard output is empty
stderr
ERROR: /home/7qsWax/prog:2:1: Syntax error: Operator expected
ERROR: /home/7qsWax/prog:23:1: 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 ? EOF: exit