improved indentation and whitespace for markdown code blocks
All code blocks in markdown have been intended by at least 4 spaces. We add `--tab-stop=8` to all `pandoc(1)` executions in order to set a better tab stop indentation, especially for tab intended code blocks. Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.3 2024-03-26" to "1.6 2024-03-31". Fixed `1991/brnstnd/sorta.README.md` so that the sorta code is code blocks. Removed unneeded paragraph group in copyright in `inc/footer.default.html`. Fixed excess whitespace after list Author on entry `index.html` page. Changed `bin/output-index-author.sh` VERSION from "1.5.2 2024-03-26" to "1.6 2024-03-31". Performed `make www` to perform the above and test under macOS. TODO: Fix the problem of the initial line of code being extra intended. TODO: Fix excess whitespace around code that is inline.
This commit is contained in:
1 parent
b84c27ce02
commit
a996f8d2b8
734 files changed
+16723
-16963
No files matched your search
@@ -1,21 +1,21 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
make
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./prog > foo.c
|
||||
./prog > foo.c
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./try.sh
|
||||
./try.sh
|
||||
```
|
||||
|
||||
The script will ask you if you wish to run `make rake` but this is not necessary
|
||||
@@ -37,16 +37,16 @@ Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:
|
||||
|
||||
```sh
|
||||
make treacl
|
||||
./treacl
|
||||
make treacl
|
||||
./treacl
|
||||
```
|
||||
|
||||
which is shorthand for:
|
||||
|
||||
```sh
|
||||
./prog < prog.c > treacle.c
|
||||
make treacle
|
||||
./treacle
|
||||
./prog < prog.c > treacle.c
|
||||
make treacle
|
||||
./treacle
|
||||
```
|
||||
|
||||
|
||||
|
||||
+9
-10
@@ -132,8 +132,7 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Yusuke_Endoh">Yusuke Endoh</a><br>
|
||||
Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<br><br></li>
|
||||
Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -142,11 +141,11 @@ Location: <a href="../../location.html#JP">JP</a> - <em>Japan</em>
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span></span></code></pre></div>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op">></span> foo.c</span></code></pre></div>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> <span class="op">></span> foo.c</span></code></pre></div>
|
||||
<h2 id="try">Try:</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">./try.sh</span></span></code></pre></div>
|
||||
<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">./try.sh</span></span></code></pre></div>
|
||||
<p>The script will ask you if you wish to run <code>make rake</code> but this is not necessary
|
||||
to fully enjoy the entry. <code>make rake</code> will run the <a href="rake.sh">rake.sh</a> script and
|
||||
then <code>prog</code> if all is built okay. If <code>rake</code> is not installed then it will check
|
||||
@@ -160,12 +159,12 @@ build <code>main.c</code>.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Big terminals with tiny fonts have their uses in certain cases.
|
||||
One of them is:</p>
|
||||
<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">make</span> treacl</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./treacl</span></span></code></pre></div>
|
||||
<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">make</span> treacl</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">./treacl</span></span></code></pre></div>
|
||||
<p>which is shorthand for:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./prog</span> <span class="op"><</span> prog.c <span class="op">></span> treacle.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> treacle</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./treacle</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> <span class="op"><</span> prog.c <span class="op">></span> treacle.c</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> treacle</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./treacle</span></span></code></pre></div>
|
||||
<p>When using a smartphone to read the output, you may need to
|
||||
step back to see the bigger picture because that picture is worth
|
||||
more than 1000 words.</p>
|
||||
|
||||
+41
-41
@@ -134,11 +134,11 @@ the program!</p>
|
||||
<h2 id="how-did-i-achieve-that">How did I achieve that?</h2>
|
||||
<p>It is known that we can mitigate the quine restriction by <code>eval</code>.
|
||||
For example, this is a quine written in Ruby:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">eval</span> s<span class="kw">=</span><span class="st">"print 'eval s='; p s"</span></span></code></pre></div>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode ruby"><code class="sourceCode ruby"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">eval</span> s<span class="kw">=</span><span class="st">"print 'eval s='; p s"</span></span></code></pre></div>
|
||||
<p>Note that <code>print</code> appears just once in the program.</p>
|
||||
<p>To emulate this approach in C, I adopted the following structure.</p>
|
||||
<pre><code>char s[]="<main code>int main() { <VM code> }";
|
||||
int main() { <VM code>; }</code></pre>
|
||||
<pre><code> char s[]="<main code>int main() { <VM code> }";
|
||||
int main() { <VM code>; }</code></pre>
|
||||
<ul>
|
||||
<li><code><VM code></code> : An own VM implementation (written in C) that executes the main
|
||||
code.</li>
|
||||
@@ -188,37 +188,37 @@ renaming and automatic register allocation only for this purpose.</p>
|
||||
<li><a href="vm.c">vm.c</a>: the source code of the VM.</li>
|
||||
</ul>
|
||||
<p>The compiler tool chain is the following.</p>
|
||||
<pre><code>src.rb interp.c
|
||||
| |
|
||||
| [parse.rb] |
|
||||
V |
|
||||
ast.txt |
|
||||
| |
|
||||
| [serialize.rb] |
|
||||
V |
|
||||
seq.txt |
|
||||
| |
|
||||
| [alpha.rb] |
|
||||
V |
|
||||
alpha.txt |
|
||||
| |
|
||||
| [register.rb] |
|
||||
V |
|
||||
reg.txt |
|
||||
| |
|
||||
| [assemble.rb] |
|
||||
V |
|
||||
raw.txt |
|
||||
| |
|
||||
+---------+---------+
|
||||
|
|
||||
| [link.rb]
|
||||
V
|
||||
main.c
|
||||
|
|
||||
| [gen-prog.c]
|
||||
V
|
||||
prog.c</code></pre>
|
||||
<pre><code> src.rb interp.c
|
||||
| |
|
||||
| [parse.rb] |
|
||||
V |
|
||||
ast.txt |
|
||||
| |
|
||||
| [serialize.rb] |
|
||||
V |
|
||||
seq.txt |
|
||||
| |
|
||||
| [alpha.rb] |
|
||||
V |
|
||||
alpha.txt |
|
||||
| |
|
||||
| [register.rb] |
|
||||
V |
|
||||
reg.txt |
|
||||
| |
|
||||
| [assemble.rb] |
|
||||
V |
|
||||
raw.txt |
|
||||
| |
|
||||
+---------+---------+
|
||||
|
|
||||
| [link.rb]
|
||||
V
|
||||
main.c
|
||||
|
|
||||
| [gen-prog.c]
|
||||
V
|
||||
prog.c</code></pre>
|
||||
<ul>
|
||||
<li><a href="parse.rb">parse.rb</a> converts Ruby to AST.</li>
|
||||
<li><a href="serialize.rb">serialize.rb</a> converts AST to intermediate instruction sequence.</li>
|
||||
@@ -230,8 +230,8 @@ raw.txt |
|
||||
<li><a href="gen-prog.c">gen-prog.c</a> generates <a href="prog.c">prog.c</a> based on <code>main.c</code>.</li>
|
||||
</ul>
|
||||
<p>You can run the process by <code>rake</code> command. <code>ruby-minisat</code> gem is needed.</p>
|
||||
<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="ex">$</span> gem install ruby-minisat</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> rake</span></code></pre></div>
|
||||
<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="ex">$</span> gem install ruby-minisat</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> rake</span></code></pre></div>
|
||||
<h2 id="tools">Tools</h2>
|
||||
<p>I checked that the following QR code readers can read the output of my program.</p>
|
||||
<ul>
|
||||
@@ -243,13 +243,13 @@ found at
|
||||
<code>https://play.google.com/store/apps/details?id=com.google.zxing.client.android</code>
|
||||
but it appears to no longer exist.</p>
|
||||
<p>You can use <a href="tool.rb">tool.rb</a> to convert the output to a png file.</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./main</span> Hello <span class="kw">|</span> <span class="ex">ruby</span> tool.rb <span class="op">></span> hello.png</span>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./main</span> Hello <span class="kw">|</span> <span class="ex">ruby</span> tool.rb <span class="op">></span> hello.png</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> zbarimg <span class="at">-q</span> hello.png</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="ex">QR-Code:Hello</span></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> zbarimg <span class="at">-q</span> hello.png</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">QR-Code:Hello</span></span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ruby tool.rb prog.c</span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> ruby tool.rb prog.c <span class="kw">|</span> <span class="ex">ruby</span> tool.rb</span></code></pre></div>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ruby tool.rb prog.c</span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a> <span class="ex">$</span> ruby tool.rb prog.c <span class="kw">|</span> <span class="ex">ruby</span> tool.rb</span></code></pre></div>
|
||||
<h2 id="limitations">Limitations</h2>
|
||||
<ul>
|
||||
<li>QR code error correction level is fixed to L (Low).</li>
|
||||
|
||||
+41
-41
@@ -19,7 +19,7 @@ It is known that we can mitigate the quine restriction by `eval`.
|
||||
For example, this is a quine written in Ruby:
|
||||
|
||||
```ruby
|
||||
eval s="print 'eval s='; p s"
|
||||
eval s="print 'eval s='; p s"
|
||||
```
|
||||
|
||||
Note that `print` appears just once in the program.
|
||||
@@ -27,8 +27,8 @@ Note that `print` appears just once in the program.
|
||||
To emulate this approach in C, I adopted the following structure.
|
||||
|
||||
```
|
||||
char s[]="<main code>int main() { <VM code> }";
|
||||
int main() { <VM code>; }
|
||||
char s[]="<main code>int main() { <VM code> }";
|
||||
int main() { <VM code>; }
|
||||
```
|
||||
|
||||
* `<VM code>` : An own VM implementation (written in C) that executes the main
|
||||
@@ -78,37 +78,37 @@ renaming and automatic register allocation only for this purpose.
|
||||
The compiler tool chain is the following.
|
||||
|
||||
```
|
||||
src.rb interp.c
|
||||
| |
|
||||
| [parse.rb] |
|
||||
V |
|
||||
ast.txt |
|
||||
| |
|
||||
| [serialize.rb] |
|
||||
V |
|
||||
seq.txt |
|
||||
| |
|
||||
| [alpha.rb] |
|
||||
V |
|
||||
alpha.txt |
|
||||
| |
|
||||
| [register.rb] |
|
||||
V |
|
||||
reg.txt |
|
||||
| |
|
||||
| [assemble.rb] |
|
||||
V |
|
||||
raw.txt |
|
||||
| |
|
||||
+---------+---------+
|
||||
|
|
||||
| [link.rb]
|
||||
V
|
||||
main.c
|
||||
|
|
||||
| [gen-prog.c]
|
||||
V
|
||||
prog.c
|
||||
src.rb interp.c
|
||||
| |
|
||||
| [parse.rb] |
|
||||
V |
|
||||
ast.txt |
|
||||
| |
|
||||
| [serialize.rb] |
|
||||
V |
|
||||
seq.txt |
|
||||
| |
|
||||
| [alpha.rb] |
|
||||
V |
|
||||
alpha.txt |
|
||||
| |
|
||||
| [register.rb] |
|
||||
V |
|
||||
reg.txt |
|
||||
| |
|
||||
| [assemble.rb] |
|
||||
V |
|
||||
raw.txt |
|
||||
| |
|
||||
+---------+---------+
|
||||
|
|
||||
| [link.rb]
|
||||
V
|
||||
main.c
|
||||
|
|
||||
| [gen-prog.c]
|
||||
V
|
||||
prog.c
|
||||
```
|
||||
|
||||
* [parse.rb](parse.rb) converts Ruby to AST.
|
||||
@@ -123,8 +123,8 @@ raw.txt |
|
||||
You can run the process by `rake` command. `ruby-minisat` gem is needed.
|
||||
|
||||
```sh
|
||||
$ gem install ruby-minisat
|
||||
$ rake
|
||||
$ gem install ruby-minisat
|
||||
$ rake
|
||||
```
|
||||
|
||||
## Tools
|
||||
@@ -146,13 +146,13 @@ but it appears to no longer exist.
|
||||
You can use [tool.rb](tool.rb) to convert the output to a png file.
|
||||
|
||||
```sh
|
||||
./main Hello | ruby tool.rb > hello.png
|
||||
./main Hello | ruby tool.rb > hello.png
|
||||
|
||||
$ zbarimg -q hello.png
|
||||
QR-Code:Hello
|
||||
$ zbarimg -q hello.png
|
||||
QR-Code:Hello
|
||||
|
||||
$ ruby tool.rb prog.c
|
||||
$ ruby tool.rb prog.c | ruby tool.rb
|
||||
$ ruby tool.rb prog.c
|
||||
$ ruby tool.rb prog.c | ruby tool.rb
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user