For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur inNote that e(g=h++,C=h++,0,0); is unspecifiedintroduces undefined behavior. If, for example, generated programs do not compile, you can try replacing the statement with h+=2;e(g=h-1,C=h-2,0,0);, which is five characters longer.
For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior. If generated programs do not compile, you can try replacing the statement with h+=2;e(g=h-1,C=h-2,0,0);, which is five characters longer.
Note that e(g=h++,C=h++,0,0); introduces undefined behavior. If, for example, generated programs do not compile, you can try replacing the statement with h+=2;e(g=h-1,C=h-2,0,0);, which is five characters longer.
For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior. If generated programs do not compile, you can try replacing the statement with h+=2;e(g=h-1,C=h-2,0,0);, which is five characters longer.
For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior.
For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior. If generated programs do not compile, you can try replacing the statement with h+=2;e(g=h-1,C=h-2,0,0);, which is five characters longer.
C, 634627 characters
#define A(v) F[v]+strlen(F[v]) #define S sprintf char*B="&&f%d(s)||f%d(s)",*J="&&f%d(s+%d)",*r,F[256][65536];h=2;e(f,n,o,R,C,O,t,g){for(C=O=f;*r;++r)switch(*r){case 40:r++;e(g=h++,C=h++,0,0);r[1]^42?t=g:(t=C,S(A(t),B,g,C=h++),r++);S;o=!S(A(O),"&&f%d(s+%d)"J,t,o);O=C;o=0;break;case;O=C;break;case 41:goto L;case'|':S(A(C),"&&f%d(s+%d)||1"J,n,o);o=0;break;default;o=!S(A(O=f),"||1");break;default:r[1]^42?S(A(C),"&&s[%d]==%d",o++,*r,O^f||R++):(o=!S(A(O),"&&f%d(s+%d)"J,t=h++,o),O=C=h++,o=0,g=h++,S(A(g),"&&*s==%d&&f%d(s+1)",*r++,t),S(A(t),B,g,C));}L:S(A(C),"&&f%d(s+%d)"J,n,o);}main(int c,char**v){r=v[1];Sr=v[1];for(e(1,!S(*F,"&&!*s");for(e(1,0,0);h--;)printf("f%d(char*s){return 1%s;}",h,F[h]);puts("main(int c,char**v){exit(f1(v[1]));}");} For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior.
C, 634 characters
#define A(v) F[v]+strlen(F[v]) #define S sprintf char*B="&&f%d(s)||f%d(s)",*r,F[256][65536];h=2;e(f,n,o,C,O,t,g){for(C=O=f;*r;++r)switch(*r){case 40:r++;e(g=h++,C=h++,0);r[1]^42?t=g:(t=C,S(A(t),B,g,C=h++),r++);S(A(O),"&&f%d(s+%d)",t,o);O=C;o=0;break;case 41:goto L;case'|':S(A(C),"&&f%d(s+%d)||1",n,o);o=0;break;default:r[1]^42?S(A(C),"&&s[%d]==%d",o++,*r):(S(A(O),"&&f%d(s+%d)",t=h++,o),O=C=h++,o=0,g=h++,S(A(g),"&&*s==%d&&f%d(s+1)",*r++,t),S(A(t),B,g,C));}L:S(A(C),"&&f%d(s+%d)",n,o);}main(int c,char**v){r=v[1];S(*F,"&&!*s");for(e(1,0,0);h--;)printf("f%d(char*s){return 1%s;}",h,F[h]);puts("main(int c,char**v){exit(f1(v[1]));}");} For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0); is unspecified behavior.
C, 627 characters
#define A(v) F[v]+strlen(F[v]) #define S sprintf char*B="&&f%d(s)||f%d(s)",*J="&&f%d(s+%d)",*r,F[256][65536];h=2;e(f,n,o,R,C,O,t,g){for(C=O=f;*r;++r)switch(*r){case 40:r++;e(g=h++,C=h++,0,0);r[1]^42?t=g:(t=C,S(A(t),B,g,C=h++),r++);o=!S(A(O),J,t,o);O=C;break;case 41:goto L;case'|':S(A(C),J,n,o);o=!S(A(O=f),"||1");break;default:r[1]^42?S(A(C),"&&s[%d]==%d",o++,*r,O^f||R++):(o=!S(A(O),J,t=h++,o),O=C=h++,g=h++,S(A(g),"&&*s==%d&&f%d(s+1)",*r++,t),S(A(t),B,g,C));}L:S(A(C),J,n,o);}main(int c,char**v){r=v[1];for(e(1,!S(*F,"&&!*s"),0,0);h--;)printf("f%d(char*s){return 1%s;}",h,F[h]);puts("main(int c,char**v){exit(f1(v[1]));}");} For a particular regex, the generated program may vary depending on your compiler, as the order the side effects occur in e(g=h++,C=h++,0,0); is unspecified behavior.