Remove hint.html and index.html
As per discussions on GitHub the index.html and hint.html files should be deleted in favour of README.md files (from any .text/.txt/.markdown/.md files which will be turned into README.md in an upcoming commit).
This commit is contained in:
1 parent
ee8a36310f
commit
77fb0f11a2
143 files changed
-28606
No files matched your search
@@ -1,246 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most lazy SKIer</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most lazy SKIer</h1>
|
||||
|
||||
<p>Yusuke Endoh<br>
|
||||
<a href="mailto:mame@ruby-lang.org">mame@ruby-lang.org</a><br>
|
||||
<a href="https://github.com/mame/">https://github.com/mame/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make
|
||||
</code></pre>
|
||||
|
||||
<p>This builds endoh1, echo, hello, and tac.</p>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./endoh1 [file.lazy]
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./endoh1 hello.lazy
|
||||
./hello
|
||||
echo Hello | ./echo
|
||||
./tac < endoh1.c
|
||||
</code></pre>
|
||||
|
||||
<p>Be patient with the last one.</p>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>We liked this entry because it can serve as a standalone program as well as an include file; and, as usual,
|
||||
because its input data is at least as obfuscated as the program itself.</p>
|
||||
|
||||
<p>This entry can be considered an abuse of the GCC’s optimizer; it takes GCC about 4x longer to compile it
|
||||
with -O3 than without, compared to clang’s 2x.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h3>Remarks</h3>
|
||||
|
||||
<pre><code>$ less prog.c
|
||||
$ gcc -o prog prog.c
|
||||
$ ./prog
|
||||
</code></pre>
|
||||
|
||||
<p>… Isn’t there any more to it?</p>
|
||||
|
||||
<p>Yes, of course.</p>
|
||||
|
||||
<p>This is a tool <em>for C programmers</em> to play the <a href="http://en.wikipedia.org/wiki/SKI_combinator_calculus">SKI combinator calculus</a>,
|
||||
especially, <a href="redacted">Lazy K</a>.</p>
|
||||
|
||||
<p>This program will shine when it is used as a library.
|
||||
For example, <code>hello.lazy</code> is a “Hello world” program written in Lazy K.</p>
|
||||
|
||||
<pre><code>$ lazy hello.lazy
|
||||
Hello, world!
|
||||
</code></pre>
|
||||
|
||||
<p>where <code>lazy</code> is <a href="redacted">a reference implementation of Lazy K</a>.
|
||||
At the same time, <code>hello.lazy</code> is <em>a valid C program</em> that uses <code>prog.c</code> as a library.</p>
|
||||
|
||||
<pre><code>$ gcc -o hello -xc hello.lazy
|
||||
$ ./hello
|
||||
Hello, world!
|
||||
</code></pre>
|
||||
|
||||
<p>In other words, this program is a kind of <a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29">polyglot</a>.</p>
|
||||
|
||||
<p>The usage is simple:
|
||||
you just have to wrap Lazy K program with <code>#include "prog.c"</code>.
|
||||
Note that <code>#</code> is a comment in Lazy K.</p>
|
||||
|
||||
<h3>Obfuscation</h3>
|
||||
|
||||
<p>… is inherent in SKI combinator calculus :-)</p>
|
||||
|
||||
<p>In addition, it uses various hacks to parse SKI code as C,
|
||||
and to satisfy IOCCC’s size rule.</p>
|
||||
|
||||
<ul>
|
||||
<li>Abuse of function pointers</li>
|
||||
<li>Code duplication by macros</li>
|
||||
<li>Short coding</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>These led to the good obfuscation.
|
||||
See Spoiler section in detail, if you need.</p>
|
||||
|
||||
<h3>Limitation</h3>
|
||||
|
||||
<p>This program supports only “Combinator-calculus style notation” of Lazy K.
|
||||
“Unlambda style” and “Iota and Jot” style are not supported.
|
||||
Also, it requires a space between identifiers.
|
||||
In short, use <code>(S K)</code> instead of <code>(SK)</code>, “`sk”, <code>**i*i*i*ii*i*i*ii</code>,
|
||||
or <code>11111100011100</code>.</p>
|
||||
|
||||
<p>Huge memory may be required to compile the program
|
||||
(about 300 MB on my machine).</p>
|
||||
|
||||
<p>In addition, there are some limitations (and workarounds)
|
||||
mentioned in Spoiler section.
|
||||
But I think it wouldn’t matter only when you run the attached programs.</p>
|
||||
|
||||
<h3>Portability</h3>
|
||||
|
||||
<p>I confirmed that the program successfully worked
|
||||
with the following compilers.</p>
|
||||
|
||||
<ul>
|
||||
<li>gcc 4.6.3 [Linux, Mac OS X]</li>
|
||||
<li>clang 3.0 [Linux, Mac OS X]</li>
|
||||
<li>tcc 0.9.26 [Linux]
|
||||
|
||||
<ul>
|
||||
<li>N.B. tcc 0.9.25 seems to have a bug and fails to run it.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Recent compilers with <code>-Wall -W -Wextra -pedantic</code> say nothing.</p>
|
||||
|
||||
<pre><code>gcc -Wall -W -Wextra -pedantic prog.c
|
||||
clang -Wall -W -Wextra -pedantic prog.c
|
||||
tcc -Wall -W -Wextra -pedantic prog.c
|
||||
</code></pre>
|
||||
|
||||
<p>I think it will work on almost all platforms. I confirmed:</p>
|
||||
|
||||
<ul>
|
||||
<li>Ubuntu Linux</li>
|
||||
<li>Mac OS X</li>
|
||||
<li>Raspberry PI</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>To check whether the program is specified on the command line
|
||||
or included from another source file,
|
||||
the program uses a predefined macro <code>__INCLUDE_LEVEL__</code>.
|
||||
It is a gcc extention, and also supported by clang.
|
||||
If your compiler does not support it,
|
||||
you cannot use the program as a library.
|
||||
But you can compile and run it as a standalone program, at least.
|
||||
In fact, tcc does not support the macro, but does work.</p>
|
||||
|
||||
<h3>Spoiler (rot13)</h3>
|
||||
|
||||
<p>Gur jubyr cebtenz vf vagrecergrq ol znpeb rkcnafvba.
|
||||
Sbe rknzcyr, <code>F (X V)</code> vf genafyngrq gb n abezny P pbqr, <code>(f)((x)(v))</code>,
|
||||
be fvzcyl <code>f(x(v))</code>.
|
||||
Guvf rkcerffvba ergheaf na nofgenpg flagnk gerr,
|
||||
naq <code>cebt.p</code> rinyhngrf vg.
|
||||
Guvf cebtenz hfrf irel fvzcyr “grez erjevgvat” nccebnpu
|
||||
sbe rinyhngvat FXV pbzovangbe pnyphyhf.
|
||||
Gur erjevgvat ehyrf ner fubja va gur funcr bs gur pbqr.</p>
|
||||
|
||||
<h4>Nohfr bs shapgvba cbvagref</h4>
|
||||
|
||||
<p>Pbafvqre n frdhrapr bs shapgvba nccyvpngvbaf va P:</p>
|
||||
|
||||
<pre><code>f(k)(k)(k)(k)...
|
||||
</code></pre>
|
||||
|
||||
<p>Jung glcr fubhyq <code>f</code> unir?
|
||||
Hasbeghangryl, P qbrf <em>abg</em> cebivqr n “erphefvir glcr”,
|
||||
fhpu nf <code>glcrqrs s (*s)();</code>.
|
||||
Fb, V hfrq n urniyl arfgrq shapgvba cbvagre glcr:</p>
|
||||
|
||||
<pre><code>glcrqrs ibvq *(*(*(*...(*(s))()...)())())
|
||||
</code></pre>
|
||||
|
||||
<p>Guvf yvzvgf ubj znal nethzragf bar shapgvba pna or pbafrphgviryl nccyvrq gb.
|
||||
Ohg lbh pna vapernfr gur ahzore ol gjrnxvat gur qrsvavgvba bs znpeb <code>c</code>.</p>
|
||||
|
||||
<h4>Pbqr qhcyvpngvba ol znpebf</h4>
|
||||
|
||||
<p>Arkg, jr arrq gb rapbqr “pybfherf”.
|
||||
N pybfher vf n shapgvba gbtrgure jvgu na raivebazrag
|
||||
juvpu vf n ersrerapr gb aba-ybpny inevnoyr.</p>
|
||||
|
||||
<p>Va guvf pnfr, jr arrq fbzrguvat gung:</p>
|
||||
|
||||
<ul>
|
||||
<li>vf pnyynoyr vgfrys,</li>
|
||||
<li>vagreanyyl cbffrffrf n ersrerapr gb nabgure pybfher nf n aba-ybpny inevnoyr, naq</li>
|
||||
<li>nccyvrf gur vagreany pybfher gb na nethzrag jura vg vf pnyyrq.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Ubjrire, ab glcr va P vf pnyynoyr naq unf n ersrerapr ng gur fnzr gvzr.
|
||||
(Vg vf srnfvoyr ol qlanzvp pbqr trarengvba, ohg vg vf sne sebz cbegnoyr.)</p>
|
||||
|
||||
<p>Fb, V nqqerffrq guvf vffhr ol trarengvat znal shapgvba qrsvavgvbaf
|
||||
fgngvpnyyl ol (no)hfvat znpebf:</p>
|
||||
|
||||
<pre><code>ibvq *k1; ibvq s1(ibvq *l) { erghea nccyl(k1, l); }
|
||||
ibvq *k2; ibvq s2(ibvq *l) { erghea nccyl(k2, l); }
|
||||
ibvq *k3; ibvq s3(ibvq *l) { erghea nccyl(k3, l); }
|
||||
...
|
||||
ibvq *(u[]) = { s1, s2, s3, ... }
|
||||
</code></pre>
|
||||
|
||||
<p>naq ol nyybgvat rnpu bs gurz jura n pybfher vf arrqrq.</p>
|
||||
|
||||
<p>Guvf yrnqf gb nabgure yvzvgngvba:
|
||||
gur ahzore bs cer-qrsvarq pybfherf yvzvgf
|
||||
ubj znal vaqragvsvref (<code>F</code> <code>X</code> <code>V</code>) bar cebtenz pna hfr.
|
||||
Ohg lbh pna vapernfr guvf ahzore
|
||||
ol gjrnxvat gur qrsvavgvba bs znpeb <code>N</code> <code>O</code> <code>P</code> naq <code>Q</code>.
|
||||
(Abgr gung pybfherf ner nyybggrq bayl jura cnefvat;
|
||||
nsgre gur rinyhngvba fgnegf, “bhg bs pybfher” pnaabg bpphe.)</p>
|
||||
|
||||
<h4>Fubeg pbeqvat</h4>
|
||||
|
||||
<p>Guvf znetva vf gbb aneebj gb pbagnva n qrgnvyrq rkcynangvba.
|
||||
Vafgrnq, V whfg nfx lbh bar dhrfgvba.
|
||||
Pna lbh gryy jung <code>i f[]={0,0,f+6,f+2,f+4,f,f+3,f+5,f+1};</code> vf?
|
||||
V sbhaq guvf ol hfvat FZG fbyire.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user