fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. [+]+[0]{0,3}[-]+ { printf("(%s)", yytext); } // Match the feature and surround it with parentheses
  8. [^+\-0\n]+ { printf("%s", yytext); } // Match any characters that are not part of the feature
  9. [+\-0]+ { printf("%s", yytext); } // Output other parts (like isolated +, -, or 0) as is
  10. \n { printf("\n"); } // Preserve newlines (row breaks)
  11.  
  12. %%
  13.  
  14. int main() {
  15. yylex(); // Start the lexer
  16. return 0;
  17. }
  18.  
  19. int yywrap() {
  20. return 1;
  21. }
  22.  
Success #stdin #stdout #stderr 0.02s 6996KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/qYzXXh/prog:21:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit