Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>C (interpreting), <strike>630</strike> <strike>622</strike> <strike>617</strike> <strike>615</strike> <strike>582</strike> <strike>576</strike> <strike>573</strike> <strike>572</strike> <strike>558</strike> <strike>554</strike> <strike>544</strike> <strike>538</strike> <strike>529</strike> <strike>504</strike> <strike>502</strike> <strike>500</strike> 499 chars</h2> <p>This understands parentheses, and works on the regexp live (i.e. not parsed first)</p> <pre><code>#define C char #define M m(s,o m(C*s,C*o,C*S,C*p,C*P,C T){C*n=P-1,*q=s,h=*P==41,c=1;for(;h*c;c-=*n--==40)c+=*n==41; c=*P-42;c=p-P?c-82?T&amp;&amp;c&amp;~1&amp;&amp;c-21?h?2:*S==*P&amp;s&lt;S?M,S-1,p,n,2)||(T&amp;4&amp;&amp;M,S-1,p,P,T|1)): 4:M,T?S:o,p,P-1,T?c&amp;~1?3:7-c:0):T&amp;&amp;s==S||M,o,p,P-1,2):T&amp;&amp;s==S;if(c==2)for(c=4;q&lt;=S;q ++)c|=m(q,S,S,n+h,P-h,2)?M,q,p,n,2)||q&lt;S&amp;T/4&amp;&amp;M,q,p,P,T&amp;6):0;return c&amp;4?c&amp;1?:T&amp;1&amp;&amp;M,S,p,n,2)||M,o,p,n,0):c;}main(C*w,C**v){C*u;for(w=*++v;*++v;)puts(m(*v -1,u,u=index(*v,0)-1,w-1,index(w,0)-1,2)?"true":"false");} </code></pre> <p>compiling with -Wall complains about argc being char. Will crash on illegal patterns.</p> <p>This parses regexp and string from right to left, saving a few chars.</p> <p>input on argv, output in <strike>reverse</strike> normal order:</p> <pre><code>$ ./a.out ab*a aa abba abab b true true false false $ ./a.out "0*1|10" 1 10 0110 00001 true true false true $ ./a.out "0*(1|1+0)" 1 10 0110 00001 true true true true $ ./a.out "a?b+|(a+b|b+a?)+" abb babab aaa aabba a b true true false true false true $ ./a.out "((A|B|C)+(a|(bbbbb)|bb|c)+)+" ABCABCaccabbbbbaACBbbb false $ ./a.out "((A|B|C)+(a|(bbbbb)|bb|c)+)+" ABCABCaccabbbbbaACBbbbb true </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload