force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+163
-244
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#John_Tromp">John Tromp</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -146,12 +146,10 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2012_tromp">2012 tromp bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2012_tromp">2012 tromp bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./tromp</span> <span class="pp">[-</span><span class="ss">b</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>Use <code>./tromp32</code> as you would <code>./tromp</code> if on a
|
||||
32-bit machine.</p>
|
||||
<p>Use <code>./tromp32</code> as you would <code>./tromp</code> if on a 32-bit machine.</p>
|
||||
<h2 id="to-use-1">To use:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> ascii-prog.blc data <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> binary-prog.Blc data <span class="kw">|</span> <span class="ex">./tromp</span></span></code></pre></div>
|
||||
@@ -161,92 +159,77 @@ href="../../bugs.html#2012_tromp">2012 tromp bugs</a>.</p>
|
||||
<p>The judges dare to say that the data files this entry is processing
|
||||
are more obfuscated than the entry itself.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>This program celebrates the close connection between obfuscation and
|
||||
conciseness, by implementing the most concise language known, <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">Binary
|
||||
Lambda Calculus (BLC)</a>.</p>
|
||||
<p><a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>
|
||||
was developed to make <a
|
||||
href="https://en.wikipedia.org/wiki/Algorithmic_information_theory">Algorithmic
|
||||
Information Theory</a>, the theory of smallest programs, more concrete.
|
||||
It starts with the simplest model of computation, the <a
|
||||
href="https://en.wikipedia.org/wiki/Lambda_calculus">lambda
|
||||
calculus</a>, and adds the minimum amount of machinery to enable binary
|
||||
input and output.</p>
|
||||
<p>More specifically, it defines a universal machine, which, from an
|
||||
input stream of bits, parses the binary encoding of a <a
|
||||
href="https://en.wikipedia.org/wiki/Lambda_calculus">lambda calculus</a>
|
||||
term, applies that to the remainder of input (translated to a lazy list
|
||||
of <a href="https://en.wikipedia.org/wiki/Boolean_algebra">booleans</a>,
|
||||
which have a standard representation in lambda calculus), and translates
|
||||
the evaluated result back into a stream of bits to be output.</p>
|
||||
<p>Lambda is encoded as 00, application as 01, and the variable bound by
|
||||
the <code>n</code>th enclosing lambda (denoted <code>n</code> in
|
||||
so-called <a href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De
|
||||
Bruijn notation</a>) as <code>1^{n}0</code>. That’s all there is to <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>!</p>
|
||||
<p>For example the encoding of lambda term
|
||||
<code>S = \x \y \z (x z) (y z)</code>, with <a
|
||||
href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De Bruijn
|
||||
notation</a> <code>\ \ \ (3 1) (2 1)</code>, is
|
||||
<code>00 00 00 01 01 1110 10 01 110 10</code>.</p>
|
||||
<p>In the closely related <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html#BLC8:_byte_sized_I.2FO">BLC8</a>
|
||||
language, I/O is byte oriented, translating between a stream of bytes
|
||||
and a list of length-8 lists of <a
|
||||
href="https://en.wikipedia.org/wiki/Boolean_algebra">booleans</a>.</p>
|
||||
<p>The submission implements the universal machine in the most concise
|
||||
manner conceivable. It lacks <code>#define</code>s and
|
||||
<code>#include</code>s, and compiles to a (stripped) executable of under
|
||||
6K in size.</p>
|
||||
<p>Without arguments, it runs in byte mode, using standard input and
|
||||
output. With one (arbitrary) argument, it runs in bit mode, using only
|
||||
the least significant bit of input, and using characters <code>0</code>
|
||||
and <code>1</code> for output.</p>
|
||||
<p>This program celebrates the close connection between obfuscation and conciseness,
|
||||
by implementing the most concise language known, <a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">Binary Lambda Calculus
|
||||
(BLC)</a>.</p>
|
||||
<p><a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a> was developed to
|
||||
make <a href="https://en.wikipedia.org/wiki/Algorithmic_information_theory">Algorithmic Information
|
||||
Theory</a>, the
|
||||
theory of smallest programs, more concrete. It starts with the simplest model of
|
||||
computation, the <a href="https://en.wikipedia.org/wiki/Lambda_calculus">lambda
|
||||
calculus</a>, and adds the minimum
|
||||
amount of machinery to enable binary input and output.</p>
|
||||
<p>More specifically, it defines a universal machine, which, from an input stream
|
||||
of bits, parses the binary encoding of a <a href="https://en.wikipedia.org/wiki/Lambda_calculus">lambda
|
||||
calculus</a> term, applies that to
|
||||
the remainder of input (translated to a lazy list of
|
||||
<a href="https://en.wikipedia.org/wiki/Boolean_algebra">booleans</a>, which have a standard
|
||||
representation in lambda calculus), and translates the evaluated result back
|
||||
into a stream of bits to be output.</p>
|
||||
<p>Lambda is encoded as 00, application as 01, and the variable bound by the <code>n</code>th
|
||||
enclosing lambda (denoted <code>n</code> in so-called <a href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De Bruijn
|
||||
notation</a>) as <code>1^{n}0</code>.
|
||||
That’s all there is to
|
||||
<a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>!</p>
|
||||
<p>For example the encoding of lambda term <code>S = \x \y \z (x z) (y z)</code>,
|
||||
with <a href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De Bruijn notation</a> <code>\ \ \ (3 1) (2 1)</code>, is <code>00 00 00 01 01 1110 10 01 110 10</code>.</p>
|
||||
<p>In the closely related
|
||||
<a href="https://tromp.github.io/cl/Binary_lambda_calculus.html#BLC8:_byte_sized_I.2FO">BLC8</a>
|
||||
language, I/O is byte oriented, translating between a stream of bytes and a list
|
||||
of length-8 lists of <a href="https://en.wikipedia.org/wiki/Boolean_algebra">booleans</a>.</p>
|
||||
<p>The submission implements the universal machine in the most concise manner conceivable.
|
||||
It lacks <code>#define</code>s and <code>#include</code>s, and compiles to a (stripped) executable of
|
||||
under 6K in size.</p>
|
||||
<p>Without arguments, it runs in byte mode, using standard input and output.
|
||||
With one (arbitrary) argument, it runs in bit mode, using only the least significant
|
||||
bit of input, and using characters <code>0</code> and <code>1</code> for output.</p>
|
||||
<p>The program uses the following exit codes:</p>
|
||||
<pre><code>0: OK; result is a finite list
|
||||
5: Out of term space
|
||||
6: Out of memory
|
||||
1,2,3,4,8,9: result not in list form</code></pre>
|
||||
<p>The size of the term space is fixed at compile time with
|
||||
<code>-DA</code>.</p>
|
||||
<p>The size of the term space is fixed at compile time with <code>-DA</code>.</p>
|
||||
<h3 id="a-half-byte-cat">A half byte <code>cat</code></h3>
|
||||
<p>The shortest (closed) lambda calculus term is <code>\x x (\ 1</code>
|
||||
in <a href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De Bruijn
|
||||
notation</a>) which is the identity function. When its encoding
|
||||
<code>0010</code> is fed into the universal machine, it will simply copy
|
||||
the input to the output (well, not that simply, since each byte is
|
||||
smashed to bits and rebuilt from scratch). Voila: a half byte cat:</p>
|
||||
<p>The shortest (closed) lambda calculus term is <code>\x x (\ 1</code> in <a href="https://en.wikipedia.org/wiki/De_Bruijn_notation">De Bruijn
|
||||
notation</a>) which is the
|
||||
identity function. When its encoding <code>0010</code> is fed into the universal machine,
|
||||
it will simply copy the input to the output (well, not that simply, since each
|
||||
byte is smashed to bits and rebuilt from scratch). Voila: a half byte cat:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">" Hello, world"</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Hello,</span> world</span></code></pre></div>
|
||||
<p>Since the least significant 4 bits of the first byte are just
|
||||
arbitrary padding that is ignored by the program, any character from
|
||||
ASCII 32 (space) through 47 (<code>/</code>) will do, e.g.:</p>
|
||||
<p>Since the least significant 4 bits of the first byte are just arbitrary padding
|
||||
that is ignored by the program, any character from ASCII 32 (space) through 47
|
||||
(<code>/</code>) will do, e.g.:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">"*Hello, world"</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Hello,</span> world</span></code></pre></div>
|
||||
<h3 id="bad-programs">Bad programs</h3>
|
||||
<p>If the input doesn’t start with a valid program, that is, if the
|
||||
interpreter reaches end-of-file during program parsing, it will crash in
|
||||
some way. E.g. the following might dump core:</p>
|
||||
<p>If the input doesn’t start with a valid program, that is,
|
||||
if the interpreter reaches end-of-file during program parsing,
|
||||
it will crash in some way. E.g. the following might dump core:</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="at">-n</span> <span class="st">"U"</span> <span class="kw">|</span> <span class="ex">./tromp</span></span></code></pre></div>
|
||||
<p>Furthermore, the interpreter requires the initial encoded lambda term
|
||||
to be closed, that is, variable <code>n</code> can only appear within at
|
||||
least <code>n</code> enclosing lambdas. For instance, here the term
|
||||
<code>\ 5</code> is not closed, causing the interpreter to crash when
|
||||
looking into a null-pointer environment:</p>
|
||||
<div class="sourceCode" id="cb10"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">">Hello, world"</span> <span class="kw">|</span> <span class="ex">./tromp</span></span></code></pre></div>
|
||||
<p>Furthermore, the interpreter requires the initial encoded lambda term to be
|
||||
closed, that is, variable <code>n</code> can only appear within at least <code>n</code> enclosing
|
||||
lambdas. For instance, here the term <code>\ 5</code> is not closed, causing the
|
||||
interpreter to crash when looking into a null-pointer environment:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">">Hello, world"</span> <span class="kw">|</span> <span class="ex">./tromp</span></span></code></pre></div>
|
||||
<p>will likely dump core.</p>
|
||||
<p>Since these properties can be checked when creating <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>
|
||||
programs, the interpreter doesn’t bother checking for it.</p>
|
||||
<p>Since these properties can be checked when creating
|
||||
<a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a> programs,
|
||||
the interpreter doesn’t bother checking for it.</p>
|
||||
<h3 id="a-self-interpreter">A Self Interpreter</h3>
|
||||
<p>The <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>
|
||||
universal machine may be small at 650 bytes of C (952 bytes including
|
||||
layout), but written as a self interpreter in BLC it is downright
|
||||
minuscule at 232 bits (29 bytes):</p>
|
||||
<p>The <a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a> universal
|
||||
machine may be small at 650 bytes of C (952 bytes including layout), but written
|
||||
as a self interpreter in BLC it is downright minuscule at 232 bits (29 bytes):</p>
|
||||
<pre><code> 01010001
|
||||
10100000
|
||||
00010101
|
||||
@@ -267,8 +250,7 @@ minuscule at 232 bits (29 bytes):</p>
|
||||
11110111 11001111
|
||||
01110110 00011001
|
||||
00011010 00011010</code></pre>
|
||||
<p>The byte oriented BLC8 version weighs in at 43 bytes (shown in
|
||||
hexadecimal).</p>
|
||||
<p>The byte oriented BLC8 version weighs in at 43 bytes (shown in hexadecimal).</p>
|
||||
<pre><code> 19468
|
||||
05580
|
||||
05f00
|
||||
@@ -282,12 +264,11 @@ hexadecimal).</p>
|
||||
0b7fb 00cf6
|
||||
7bb03 91a1a
|
||||
</code></pre>
|
||||
<div class="sourceCode" id="cb13"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span><span class="fu">cat</span> uni8.Blc<span class="kw">;</span> <span class="bu">echo</span> <span class="st">" Ni hao"</span><span class="kw">)</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span><span class="fu">cat</span> uni8.Blc<span class="kw">;</span> <span class="bu">echo</span> <span class="st">" Ni hao"</span><span class="kw">)</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Ni</span> hao</span></code></pre></div>
|
||||
<h3 id="a-prime-number-sieve">A prime number sieve</h3>
|
||||
<p>Even shorter than the self-interpreter is this prime number sieve in
|
||||
167 bits (under 21 bytes):</p>
|
||||
<p>Even shorter than the self-interpreter is this prime number sieve in 167 bits
|
||||
(under 21 bytes):</p>
|
||||
<pre><code> 000100011001100101000110100
|
||||
000000101100000100100010101
|
||||
11110111 101001000
|
||||
@@ -298,21 +279,17 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#
|
||||
00010110
|
||||
0000110110
|
||||
</code></pre>
|
||||
<p>The <code>n</code>th bit in the output indicates whether n is
|
||||
prime:</p>
|
||||
<div class="sourceCode" id="cb15"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 70</span>
|
||||
<p>The <code>n</code>th bit in the output indicates whether n is prime:</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 70</span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="ex">0011010100010100010100010000010100000100010100010000010000010100000100</span></span></code></pre></div>
|
||||
<p>For those who prefer to digest their primes in decimal, there is
|
||||
<code>oddindices.Blc</code>, which will print the indices of all odd
|
||||
characters (with <a
|
||||
href="https://en.wikipedia.org/wiki/Bit_numbering">LSB</a> = 1)
|
||||
<p>For those who prefer to digest their primes in decimal, there is <code>oddindices.Blc</code>,
|
||||
which will print the indices of all odd characters (with
|
||||
<a href="https://en.wikipedia.org/wiki/Bit_numbering">LSB</a> = 1)
|
||||
separated by a given character:</p>
|
||||
<pre><code>$ (cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70
|
||||
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97</code></pre>
|
||||
<h3 id="a-space-filling-program">A Space filling program</h3>
|
||||
<p>The program <code>hilbert.Blc</code>, at 143 bytes, is a very twisty
|
||||
“one-liner” (shown in hexadecimal):</p>
|
||||
<p>The program <code>hilbert.Blc</code>, at 143 bytes, is a very twisty “one-liner” (shown in hexadecimal):</p>
|
||||
<pre><code> 1818181 8111154 6806041 55ff041
|
||||
9d f9 de 16 ff fe 5f 3f
|
||||
ef f615ff9 46 84 058117e 05
|
||||
@@ -328,12 +305,9 @@ separated by a given character:</p>
|
||||
3fe80b2 2c18581 bfe5c10 42ff805
|
||||
de ec 06 c2 c0 c0
|
||||
60 8191a00167fb cbcfdf65f7c0 a20</code></pre>
|
||||
<p>It expects <code>n</code> arbitrary characters of input, and draws a
|
||||
space filling <a
|
||||
href="https://en.wikipedia.org/wiki/Hilbert_curve">Hilbert curve</a> of
|
||||
order <code>n</code>:</p>
|
||||
<div class="sourceCode" id="cb18"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span><span class="fu">cat</span> hilbert.Blc<span class="kw">;</span> <span class="bu">echo</span> <span class="at">-n</span> <span class="st">"1"</span><span class="kw">)</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<p>It expects <code>n</code> arbitrary characters of input, and draws a space filling <a href="https://en.wikipedia.org/wiki/Hilbert_curve">Hilbert
|
||||
curve</a> of order <code>n</code>:</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> <span class="er">(</span><span class="fu">cat</span> hilbert.Blc<span class="kw">;</span> <span class="bu">echo</span> <span class="at">-n</span> <span class="st">"1"</span><span class="kw">)</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">_</span></span>
|
||||
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a><span class="kw">|</span> <span class="kw">|</span></span>
|
||||
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a></span>
|
||||
@@ -370,11 +344,9 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#
|
||||
<span id="cb18-35"><a href="#cb18-35" aria-hidden="true" tabindex="-1"></a><span class="kw">|</span> <span class="kw">|</span><span class="ex">_</span><span class="kw">|</span> <span class="kw">|</span> <span class="kw">|</span><span class="ex">_</span><span class="kw">|</span> <span class="ex">_</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">_</span> <span class="kw">|</span><span class="ex">_</span><span class="kw">|</span> <span class="kw">|</span> <span class="kw">|</span><span class="ex">_</span><span class="kw">|</span> <span class="kw">|</span></span>
|
||||
<span id="cb18-36"><a href="#cb18-36" aria-hidden="true" tabindex="-1"></a><span class="kw">|</span><span class="ex">_</span> _<span class="kw">|</span> <span class="ex">_</span> <span class="kw">|</span><span class="ex">_</span> _<span class="kw">|</span> <span class="ex">_</span> <span class="kw">|</span><span class="ex">_</span> _<span class="kw">|</span></span>
|
||||
<span id="cb18-37"><a href="#cb18-37" aria-hidden="true" tabindex="-1"></a> <span class="ex">_</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">___</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">___</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">___</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">___</span><span class="kw">|</span> <span class="kw">|</span><span class="ex">_</span></span></code></pre></div>
|
||||
<h3 id="a-brainfuck-interpreter">A <a
|
||||
href="https://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a>
|
||||
interpreter</h3>
|
||||
<p>The smallest known BF interpreter is written in… you guessed it, <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>,
|
||||
<h3 id="a-brainfuck-interpreter">A <a href="https://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> interpreter</h3>
|
||||
<p>The smallest known BF interpreter is written in… you guessed it,
|
||||
<a href="https://tromp.github.io/cl/Binary_lambda_calculus.html">BLC</a>,
|
||||
coming in at 112 bytes (including 3 bits of padding):</p>
|
||||
<pre><code>$ od -t x4 bf.Blc
|
||||
0000000 01a15144 02d55584 223070b7 00f032ff
|
||||
@@ -385,53 +357,41 @@ coming in at 112 bytes (including 3 bits of padding):</p>
|
||||
0000120 e51fee99 6a5a7fff ff0fff1f d0049d87
|
||||
0000140 db0500ab 3bb74023 b0c0cc28 10740e6c
|
||||
0000160</code></pre>
|
||||
<p>It expects its input to consist of a <a
|
||||
href="https://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> program
|
||||
(looking only at bits <code>0</code>, <code>1</code> and <code>4</code>
|
||||
to distinguish among <code>,-.+<>][</code>) followed by a
|
||||
<code>]</code>, followed by the input for the Brainfuck program.</p>
|
||||
<p>It expects its input to consist of a
|
||||
<a href="https://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> program
|
||||
(looking only at bits <code>0</code>, <code>1</code> and <code>4</code> to distinguish among <code>,-.+<>][</code>)
|
||||
followed by a <code>]</code>, followed by the input for the Brainfuck program.</p>
|
||||
<pre><code>$ more hw.bf
|
||||
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.]
|
||||
$ cat bf.Blc hw.bf | ./tromp
|
||||
Hello World!</code></pre>
|
||||
<p>Curiously, the interpreter <code>bf.Blc</code> is the exact same size
|
||||
as <code>hw.bf</code>.</p>
|
||||
<p>Curiously, the interpreter <code>bf.Blc</code> is the exact same size as <code>hw.bf</code>.</p>
|
||||
<h3 id="a-blc-assembler">A BLC assembler</h3>
|
||||
<p>Writing BLC programs can be made slightly less painful with this
|
||||
parser that translates single-letter-variable lambda calculus into
|
||||
BLC:</p>
|
||||
<div class="sourceCode" id="cb21"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">"\f\x f (f (f x))"</span> <span class="op">></span> three</span>
|
||||
<p>Writing BLC programs can be made slightly less painful with this parser that
|
||||
translates single-letter-variable lambda calculus into BLC:</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">"\f\x f (f (f x))"</span> <span class="op">></span> three</span>
|
||||
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat parse.Blc three <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a><span class="ex">000001110011100111010</span></span></code></pre></div>
|
||||
<h3 id="converting-between-bits-and-bytes">Converting between bits and
|
||||
bytes</h3>
|
||||
<p>The program <code>inflate.Blc</code> and its inverse
|
||||
<code>deflate.Blc</code> allow us to translate between BLC and BLC8. If
|
||||
you assemble a byte oriented program, you’ll need to compact it into
|
||||
BLC8:</p>
|
||||
<h3 id="converting-between-bits-and-bytes">Converting between bits and bytes</h3>
|
||||
<p>The program <code>inflate.Blc</code> and its inverse <code>deflate.Blc</code> allow us to translate between
|
||||
BLC and BLC8. If you assemble a byte oriented program, you’ll need to compact it
|
||||
into BLC8:</p>
|
||||
<p>So we could assemble an input reversing program as</p>
|
||||
<div class="sourceCode" id="cb22"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">"\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)"</span> <span class="op">></span> reverse</span>
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">"\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)"</span> <span class="op">></span> reverse</span>
|
||||
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> parse.Blc reverse <span class="kw">|</span> <span class="ex">./tromp</span> <span class="op">></span> reverse.blc</span></code></pre></div>
|
||||
<p>and change it to BLC8 with</p>
|
||||
<div class="sourceCode" id="cb23"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat deflate.Blc reverse.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="op">></span> rev.Blc</span>
|
||||
<div class="sourceCode" id="cb23"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat deflate.Blc reverse.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="op">></span> rev.Blc</span>
|
||||
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> wc rev.Blc</span>
|
||||
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">0</span> 1 9 rev.Blc</span></code></pre></div>
|
||||
<p>and then try it out with:</p>
|
||||
<div class="sourceCode" id="cb24"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat rev.Blc <span class="at">-</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<div class="sourceCode" id="cb24"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat rev.Blc <span class="at">-</span> <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a><span class="ex">Hello,</span> world!</span>
|
||||
<span id="cb24-3"><a href="#cb24-3" aria-hidden="true" tabindex="-1"></a><span class="ex">^D</span></span>
|
||||
<span id="cb24-4"><a href="#cb24-4" aria-hidden="true" tabindex="-1"></a><span class="ex">!dlrow</span> ,olleH</span></code></pre></div>
|
||||
<h3 id="symbolic-lambda-calculus-reduction">Symbolic Lambda Calculus
|
||||
reduction</h3>
|
||||
<p>BLC8 program <code>symbolic.Blc</code> shows individual reduction
|
||||
steps on symbolic lambda terms. Here it is used to show the calculation
|
||||
of 2^3 in Church numerals:</p>
|
||||
<div class="sourceCode" id="cb25"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">"(\f\x f (f (f x))) (\f\x f (f x))"</span> <span class="op">></span> threetwo</span>
|
||||
<h3 id="symbolic-lambda-calculus-reduction">Symbolic Lambda Calculus reduction</h3>
|
||||
<p>BLC8 program <code>symbolic.Blc</code> shows individual reduction steps on symbolic lambda terms.
|
||||
Here it is used to show the calculation of 2^3 in Church numerals:</p>
|
||||
<div class="sourceCode" id="cb25"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> echo <span class="st">"(\f\x f (f (f x))) (\f\x f (f x))"</span> <span class="op">></span> threetwo</span>
|
||||
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat parse.Blc threetwo <span class="kw">|</span> <span class="ex">./tromp</span> <span class="op">></span> threetwo.blc</span>
|
||||
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat symbolic.Blc threetwo.blc <span class="kw">|</span> <span class="ex">./tromp</span></span>
|
||||
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a><span class="kw">(</span><span class="ex">\a</span> <span class="dt">\b</span> a <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> b<span class="kw">)))</span> <span class="kw">(</span><span class="ex">\a</span> <span class="dt">\b</span> a <span class="er">(</span><span class="ex">a</span> b<span class="kw">))</span></span>
|
||||
@@ -449,50 +409,41 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb25-1"><a href="#
|
||||
<span id="cb25-16"><a href="#cb25-16" aria-hidden="true" tabindex="-1"></a><span class="ex">\a</span> <span class="dt">\b</span> a <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="kw">(</span><span class="ex">\c</span> <span class="dt">\d</span> c <span class="er">(</span><span class="ex">c</span> d<span class="kw">))</span> <span class="ex">a</span> b<span class="kw">))))))</span></span>
|
||||
<span id="cb25-17"><a href="#cb25-17" aria-hidden="true" tabindex="-1"></a><span class="ex">\a</span> <span class="dt">\b</span> a <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="kw">(</span><span class="ex">\c</span> a <span class="er">(</span><span class="ex">a</span> c<span class="kw">))</span> <span class="ex">b</span><span class="kw">))))))</span></span>
|
||||
<span id="cb25-18"><a href="#cb25-18" aria-hidden="true" tabindex="-1"></a><span class="ex">\a</span> <span class="dt">\b</span> a <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> <span class="er">(</span><span class="ex">a</span> b<span class="kw">)))))))</span></span></code></pre></div>
|
||||
<p>As expected, the resulting normal form is <a
|
||||
href="https://en.wikipedia.org/wiki/Church_encoding">Church numeral</a>
|
||||
8.</p>
|
||||
<p>Taking only the first line of output gives us a sort of BLC
|
||||
disassembler, an exact inverse of the above assembler. The prime number
|
||||
sieve disassembles as follows:</p>
|
||||
<div class="sourceCode" id="cb26"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat symbolic.Blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-1</span></span>
|
||||
<p>As expected, the resulting normal form is <a href="https://en.wikipedia.org/wiki/Church_encoding">Church
|
||||
numeral</a> 8.</p>
|
||||
<p>Taking only the first line of output gives us a sort of BLC disassembler, an
|
||||
exact inverse of the above assembler. The prime number sieve disassembles as
|
||||
follows:</p>
|
||||
<div class="sourceCode" id="cb26"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cat symbolic.Blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-1</span></span>
|
||||
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a><span class="ex">\a</span> <span class="er">(</span><span class="ex">\b</span> b <span class="er">(</span><span class="ex">b</span> <span class="er">(</span><span class="kw">(</span><span class="ex">\c</span> c c<span class="kw">)</span> <span class="kw">(</span><span class="ex">\c</span> <span class="dt">\d</span> <span class="dt">\e</span> e <span class="er">(</span><span class="ex">\f</span> <span class="dt">\g</span> g<span class="kw">)</span> <span class="kw">((</span><span class="ex">\f</span> c c f <span class="er">(</span><span class="kw">(</span><span class="ex">\g</span> g g<span class="kw">)</span> <span class="kw">(</span><span class="ex">\g</span> f <span class="er">(</span><span class="ex">g</span> g<span class="kw">))))</span> <span class="kw">(</span><span class="ex">\f</span> <span class="dt">\g</span> <span class="dt">\h</span> <span class="dt">\i</span> i g <span class="er">(</span><span class="ex">h</span> <span class="er">(</span><span class="ex">d</span> f<span class="kw">)))))</span> <span class="kw">(</span><span class="ex">\c</span> <span class="dt">\d</span> <span class="dt">\e</span> b <span class="er">(</span><span class="ex">e</span> c<span class="kw">)))))</span> <span class="kw">(</span><span class="ex">\b</span> <span class="dt">\c</span> c <span class="er">(</span><span class="ex">\d</span> <span class="dt">\e</span> d<span class="kw">)</span> <span class="ex">b</span><span class="kw">)</span></span></code></pre></div>
|
||||
<p>Hardly any less obfuscated…</p>
|
||||
<p>The last line of</p>
|
||||
<div class="sourceCode" id="cb27"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> symbolic.Blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-16</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb27"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cat</span> symbolic.Blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-16</span></span></code></pre></div>
|
||||
<p>starts out as</p>
|
||||
<pre><code>\a \b b (\c \d c) (\c c (\d \e d) (\d d (\e \f f) (\e e (\f \g g) ((\f (\g \h \i</code></pre>
|
||||
<p>The <code>\a</code> is for ignoring the rest of the input (to which
|
||||
the universal machine applies the decoded lambda term). The
|
||||
<code>\b b (..) (...)</code> is the list constructor, usually called
|
||||
<code>cons</code>, applied to a head (a list element) and a tail
|
||||
(another list). In this case the element is <code>(\c \d c)</code>,
|
||||
which represents the boolean true, and which we use to represent a 0
|
||||
bit. This is the bit that says 0 is not prime. The next list element
|
||||
(following another <code>cons</code>) is <code>(\d \e d)</code>. Another
|
||||
0 bit, this time saying that 1 is not prime. The third list element is
|
||||
<code>(\e \f f)</code>, a 1 bit, confirming our suspicion that 2 is
|
||||
prime. As is the next number, according to <code>(\f \g g)</code>. We
|
||||
can see that the tail after the first 4 elements is still subject to
|
||||
further reduction. The bit for number 4 will show up for the first time
|
||||
in line 30, as <code>(\g \h g)</code>, or 0, as the result of zeroing
|
||||
<p>The <code>\a</code> is for ignoring the rest of the input (to which the universal machine
|
||||
applies the decoded lambda term). The <code>\b b (..) (...)</code> is the list constructor,
|
||||
usually called <code>cons</code>, applied to a head (a list element) and a tail (another list).
|
||||
In this case the element is <code>(\c \d c)</code>, which represents the boolean true, and
|
||||
which we use to represent a 0 bit. This is the bit that says 0 is not prime.
|
||||
The next list element (following another <code>cons</code>) is <code>(\d \e d)</code>. Another 0 bit,
|
||||
this time saying that 1 is not prime. The third list element is <code>(\e \f f)</code>,
|
||||
a 1 bit, confirming our suspicion that 2 is prime. As is the next number,
|
||||
according to <code>(\f \g g)</code>. We can see that the tail after the first 4 elements
|
||||
is still subject to further reduction. The bit for number 4 will show up
|
||||
for the first time in line 30, as <code>(\g \h g)</code>, or 0, as the result of zeroing
|
||||
out all multiples of the first prime, 2.</p>
|
||||
<p>Since my computer reaches swap hell before line 40, we can’t see the
|
||||
next bit arriving, at least not in this symbolic reduction.</p>
|
||||
<p>Since my computer reaches swap hell before line 40, we can’t see the next bit arriving,
|
||||
at least not in this symbolic reduction.</p>
|
||||
<h3 id="performance">Performance</h3>
|
||||
<p>Performance is quite decent, and amazingly good for such a tiny
|
||||
implementation, being roughly 50% slower than a Haskell implementation
|
||||
of the universal machine using so-called <a
|
||||
href="https://en.wikipedia.org/wiki/Higher-order_abstract_syntax">Higher
|
||||
Order Abstract Syntax</a> which relies on the highly optimized Haskell
|
||||
runtime system for evaluation. Of course individual BLC programs running
|
||||
under the interpreter perform much worse than that same program written
|
||||
in Haskell.</p>
|
||||
<p>Performance is quite decent, and amazingly good for such a tiny implementation,
|
||||
being roughly 50% slower than a Haskell implementation of the universal machine
|
||||
using so-called <a href="https://en.wikipedia.org/wiki/Higher-order_abstract_syntax">Higher Order Abstract
|
||||
Syntax</a> which relies on the highly optimized
|
||||
Haskell runtime system for evaluation. Of course individual BLC programs running
|
||||
under the interpreter perform much worse than that same program written in Haskell.</p>
|
||||
<p>Our interpreter copes well with extra levels of interpretation:</p>
|
||||
<div class="sourceCode" id="cb29"><pre
|
||||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> time cat primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 210 <span class="op">></span> /dev/null</span>
|
||||
<div class="sourceCode" id="cb29"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> time cat primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 210 <span class="op">></span> /dev/null</span>
|
||||
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a><span class="ex">real</span> 0m0.043s</span>
|
||||
<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> time cat uni.blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 210 <span class="op">></span> /dev/null</span>
|
||||
<span id="cb29-4"><a href="#cb29-4" aria-hidden="true" tabindex="-1"></a><span class="ex">real</span> 0m0.191s</span>
|
||||
@@ -503,17 +454,15 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb29-1"><a href="#
|
||||
<span id="cb29-9"><a href="#cb29-9" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> time cat uni.blc uni.blc uni.blc uni.blc primes.blc <span class="kw">|</span> <span class="ex">./tromp</span> <span class="at">-b</span> <span class="kw">|</span> <span class="fu">head</span> <span class="at">-c</span> 210 <span class="op">></span> /dev/null</span>
|
||||
<span id="cb29-10"><a href="#cb29-10" aria-hidden="true" tabindex="-1"></a><span class="ex">real</span> 4m52.700s</span></code></pre></div>
|
||||
<h3 id="obfuscation">Obfuscation</h3>
|
||||
<p>Obfuscation is due entirely to conciseness. Some questions to
|
||||
ponder:</p>
|
||||
<p>Which of the term space codes <code>0</code>, <code>1</code>,
|
||||
<code>2</code>, <code>3</code> serve multiple purposes?</p>
|
||||
<p>Obfuscation is due entirely to conciseness. Some questions to ponder:</p>
|
||||
<p>Which of the term space codes <code>0</code>, <code>1</code>, <code>2</code>, <code>3</code> serve multiple purposes?</p>
|
||||
<p>Why is the environment pointer pointing into the term space?</p>
|
||||
<p>What does the test <code>u+m&1?</code> do?</p>
|
||||
<p>How does the program reach exit code 0?</p>
|
||||
<p>And how do any of those BLC programs work?</p>
|
||||
<h3 id="portability">Portability</h3>
|
||||
<p>The program freely (without casting) converts between
|
||||
<code>int</code> and <code>int *</code>, causing many warnings;</p>
|
||||
<p>The program freely (without casting) converts between <code>int</code> and <code>int *</code>, causing
|
||||
many warnings;</p>
|
||||
<pre><code> note: expected 'int *' but argument is of type 'int'
|
||||
warning: assignment from incompatible pointer type
|
||||
warning: assignment makes integer from pointer without a cast
|
||||
@@ -523,95 +472,65 @@ ponder:</p>
|
||||
warning: passing argument 1 of 'd' makes pointer from integer without a cast
|
||||
warning: passing argument 1 of 'p' makes pointer from integer without a cast
|
||||
warning: pointer/integer type mismatch in conditional expression</code></pre>
|
||||
<p>Avoiding these would make the program substantially longer, and
|
||||
detract from its single minded focus on conciseness.</p>
|
||||
<p>It implicitly declares functions <code>read(2)</code>,
|
||||
<code>write(2)</code>, <code>exit(3)</code> and <code>calloc(3)</code>,
|
||||
the latter two incompatibly. 32 bit and 64 bit executables are separate
|
||||
<a href="Makefile">Makefile</a> targets, involving a change from
|
||||
<code>int</code> to <code>long</code> and from a hardcoded sizeof of 4
|
||||
to 8.</p>
|
||||
<p>The program has been tested to work correctly on Linux/Solaris/MacOSX
|
||||
both in 32 and 64 bits.</p>
|
||||
<p>Avoiding these would make the program substantially longer,
|
||||
and detract from its single minded focus on conciseness.</p>
|
||||
<p>It implicitly declares functions <code>read(2)</code>, <code>write(2)</code>, <code>exit(3)</code> and
|
||||
<code>calloc(3)</code>, the latter two incompatibly. 32 bit and 64 bit executables are
|
||||
separate <a href="Makefile">Makefile</a> targets, involving a change from <code>int</code> to <code>long</code>
|
||||
and from a hardcoded sizeof of 4 to 8.</p>
|
||||
<p>The program has been tested to work correctly on Linux/Solaris/MacOSX both in 32
|
||||
and 64 bits.</p>
|
||||
<h3 id="how-the-program-works">How the program works</h3>
|
||||
<p>See the file <a href="how.html">how.html</a>.</p>
|
||||
<h3 id="acknowledgements">Acknowledgements</h3>
|
||||
<p>Christopher Hendrie, Bertram Felgenhauer, Alex Stangl, Seong-hoon
|
||||
Kang, and <a href="../../authors.html#Yusuke_Endoh">Yusuke Endoh</a>
|
||||
have contributed ideas and suggestions for improvement.</p>
|
||||
<p>Christopher Hendrie, Bertram Felgenhauer, Alex Stangl, Seong-hoon Kang,
|
||||
and <a href="../../authors.html#Yusuke_Endoh">Yusuke Endoh</a> have contributed ideas and
|
||||
suggestions for improvement.</p>
|
||||
<h3 id="references">References</h3>
|
||||
<p>Binary Lambda Calculus - <a
|
||||
href="https://tromp.github.io/cl/Binary_lambda_calculus.html"
|
||||
class="uri">https://tromp.github.io/cl/Binary_lambda_calculus.html</a></p>
|
||||
<p>G J Chaitin, Algorithmic information theory, Volume I, Cambridge
|
||||
Tracts in Theoretical Computer Science, Cambridge University Press,
|
||||
October 1987. <a
|
||||
href="https://web.archive.org/web/20121125233450/https://www.cs.auckland.ac.nz/~chaitin/cup.html"
|
||||
class="uri">https://web.archive.org/web/20121125233450/https://www.cs.auckland.ac.nz/~chaitin/cup.html</a></p>
|
||||
<p>Jean-Louis Krivine. 2007. A call-by-name lambda-calculus machine
|
||||
Higher Order Symbol. Comput. 20, 3 (September 2007), 199-207. <a
|
||||
href="http://www.pps.univ-paris-diderot.fr/~krivine/articles/lazymach.pdf"
|
||||
class="uri">http://www.pps.univ-paris-diderot.fr/~krivine/articles/lazymach.pdf</a></p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>Binary Lambda Calculus -
|
||||
<a href="https://tromp.github.io/cl/Binary_lambda_calculus.html" class="uri">https://tromp.github.io/cl/Binary_lambda_calculus.html</a></p>
|
||||
<p>G J Chaitin, Algorithmic information theory, Volume I,
|
||||
Cambridge Tracts in Theoretical Computer Science, Cambridge University Press, October 1987.
|
||||
<a href="https://web.archive.org/web/20121125233450/https://www.cs.auckland.ac.nz/~chaitin/cup.html" class="uri">https://web.archive.org/web/20121125233450/https://www.cs.auckland.ac.nz/~chaitin/cup.html</a></p>
|
||||
<p>Jean-Louis Krivine. 2007.
|
||||
A call-by-name lambda-calculus machine
|
||||
Higher Order Symbol. Comput. 20, 3 (September 2007), 199-207.
|
||||
<a href="http://www.pps.univ-paris-diderot.fr/~krivine/articles/lazymach.pdf" class="uri">http://www.pps.univ-paris-diderot.fr/~krivine/articles/lazymach.pdf</a></p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2012tromp"><a name="inventory"></a>Inventory for
|
||||
2012/tromp</h1>
|
||||
<h1 id="inventory-for-2012tromp"><a name="inventory"></a>Inventory for 2012/tromp</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/tromp.c">tromp.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/tromp.orig.c">tromp.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/tromp.c">tromp.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/tromp.orig.c">tromp.orig.c</a> - original source</li>
|
||||
<li><a href="how.html">how.html</a> - author supplied spoiler</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/primes.pl">primes.pl</a>
|
||||
- post process tromp output to print primes</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/hw.bf">hw.bf</a>
|
||||
- bf source code</li>
|
||||
<li><a href="2012_tromp.tar.bz2">2012_tromp.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/primes.pl">primes.pl</a> - post process tromp output to print primes</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/hw.bf">hw.bf</a> - bf source code</li>
|
||||
<li><a href="2012_tromp.tar.bz2">2012_tromp.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="bf.Blc">bf.Blc</a> - sample input</li>
|
||||
<li><a href="deflate.Blc">deflate.Blc</a> - sample input</li>
|
||||
<li><a href="hilbert.Blc">hilbert.Blc</a> - sample input</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/how.md">how.md</a>
|
||||
- markdown source for how.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/tromp/how.md">how.md</a> - markdown source for how.html</li>
|
||||
<li><a href="inflate.Blc">inflate.Blc</a> - sample input</li>
|
||||
<li><a href="oddindices.Blc">oddindices.Blc</a> - sample input</li>
|
||||
<li><a href="parse.Blc">parse.Blc</a> - sample input</li>
|
||||
|
||||
Reference in new issue
Block a user