summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-09-30 14:22:48 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2021-09-30 14:22:48 +0200
commit9071723d55055307f0e92ae0f9d3194079aa086e (patch)
treeaae9b273319a5beee2c0b13ed8b3850ebe305f0d
parent2e707c4702a06bbe6f44efc732820f6eacce27f9 (diff)
downloadcompilertests-9071723d55055307f0e92ae0f9d3194079aa086e.tar.gz
compilertests-9071723d55055307f0e92ae0f9d3194079aa086e.tar.bz2
fixed HTML generation for <code> tags
-rw-r--r--miniany/Makefile8
-rw-r--r--miniany/README.html40
-rw-r--r--miniany/cc.wg12
3 files changed, 38 insertions, 22 deletions
diff --git a/miniany/Makefile b/miniany/Makefile
index 24c535e..7ebaf6c 100644
--- a/miniany/Makefile
+++ b/miniany/Makefile
@@ -1,10 +1,14 @@
-.PHONY: doc
+.PHONY: doc clean
doc: README.html
+clean:
+ rm cc.md README.html
+
README.html: cc.md
- md2html --fpermissive-url-autolinks < cc.md > README.html
+ md2html --fpermissive-url-autolinks < cc.md > README.html
cc.md: cc.wg
wordgrinder -c cc.wg cc.md
+ sed -i 's/`/\n```\n/g' cc.md
\ No newline at end of file
diff --git a/miniany/README.html b/miniany/README.html
index 411c667..40c9c49 100644
--- a/miniany/README.html
+++ b/miniany/README.html
@@ -20,12 +20,12 @@
<ul>
<li>switch statement from the <i>switch-and-struct</i>s branch, adapted c4 itself to use switch statements instead of if's (as in the <i>switch-and-structs </i>branch)</li>
<li>struct support from <i>switch-and-structs</i></li>
-<li>constants like <i>EO</i>F, <i>EXIT_SUCCES</i>S, <i>NUL</i>L</li>
+<li>constants like <i>EOF</i>, <i>EXIT_SUCCESS</i>, <i>NULL</i></li>
<li>standard C block comments along to c++ end of line ones</li>
<li>negative enum initializers</li>
<li>do/while loops</li>
-<li>more C functions like <i>isspac</i>e, <i>get</i>c, <i>strcm</i>p</li>
-<li>some simplified functions for printing like <i>putstring</i>, <i>putin</i>t, <i>putn</i>l</li>
+<li>more C functions like <i>isspace</i>, <i>getc</i>, <i>strcmp</i></li>
+<li>some simplified functions for printing like <i>putstring</i>, <i>putint</i>, <i>putnl</i></li>
<li>strict C89 conformance, mainly use standard comment blocks, also removed some warnings</li>
<li>some casts around malloc and memset to fit to non-void freestanding-libc</li>
<li>converted printf to putstring/putint/putnl and some helper functions for error reporting like error()</li>
@@ -36,21 +36,33 @@
<h2>Examples</h2>
<h3>Running on the host system using the hosts C compiler</h3>
<p>Compiled in either hosted (host libc) or freestanding (our own libc, currently IA-32 Linux kernel only syscalls):</p>
-<p><code>./build.sh cc hostcc hosted d ./build.sh cc hostcc freestanding d ./cc \&lt; test1.c \&gt; test1.asm</code>
-Create a plain binary from the assembly code:</p>
-<p><code>fasm test1.asm test1.bin</code>
-Disassemble it to verify it's correctness:</p>
-<p><code>ndisasm -b32 -o1000000h -a test1.bin</code>
-You can choose <i>gcc</i>, <i>clang</i>, <i>tcc </i>or <i>pcc </i>as host compiler (<i>hostcc</i>).</p>
+<pre><code>./build.sh cc hostcc hosted d
+./build.sh cc hostcc freestanding d
+./cc \&lt; test1.c \&gt; test1.asm
+</code></pre>
+<p>Create a plain binary from the assembly code:</p>
+<pre><code>fasm test1.asm test1.bin
+</code></pre>
+<p>Disassemble it to verify it's correctness:</p>
+<pre><code>ndisasm -b32 -o1000000h -a test1.bin
+</code></pre>
+<p>You can choose <i>gcc</i>, <i>clang</i>, <i>tcc </i>or <i>pcc </i>as host compiler (<i>hostcc</i>).</p>
<h3>Running on the host in the C4 interpreter</h3>
<p>Running in C4 interpreter, again, the C4 program can be compiled in hosted or freestanding mode:</p>
-<p><code>./build.sh c4 hostcc hosted d ./build.sh c4 hostcc freestanding d</code>
-Here again you can choose the host compiler for compiling C4.</p>
+<pre><code>./build.sh c4 hostcc hosted d
+./build.sh c4 hostcc freestanding d
+</code></pre>
+<p>Here again you can choose the host compiler for compiling C4.</p>
<p>Then we have to create the standard input for C4 using:</p>
-<p><code>echo -n -e &quot;\034&quot; \&gt; EOF cat cc.c EOF hello.c | ./c4 cat c4.c EOF cc.c EOF hello.c | ./c4 cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4</code>
-EOF contains the traditional FS (file separator) character in the ASCII character set. Every time c4/c4.c is invoked it reads exacly one input file up to the first FS character (or stops at the end of stdin).</p>
+<pre><code>echo -n -e &quot;\034&quot; \&gt; EOF
+cat cc.c EOF hello.c | ./c4
+cat c4.c EOF cc.c EOF hello.c | ./c4
+cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4
+</code></pre>
+<p>EOF contains the traditional FS (file separator) character in the ASCII character set. Every time c4/c4.c is invoked it reads exacly one input file up to the first FS character (or stops at the end of stdin).</p>
<p>We can also use <i>-s</i>, or <i>-d </i>on every level as follows:</p>
-<p><code>cat cc.c EOF hello.c | ./c4 -d</code></p>
+<pre><code>cat cc.c EOF hello.c | ./c4 -d
+</code></pre>
<h2>References</h2>
<p>Compiler construction in general:</p>
<ul>
diff --git a/miniany/cc.wg b/miniany/cc.wg
index e2b2c47..dbf56a9 100644
--- a/miniany/cc.wg
+++ b/miniany/cc.wg
@@ -29,9 +29,9 @@ WordGrinder dumpfile v3: this is a text file; diff me!
.clipboard.margin: 0
.clipboard.viewmode: 1
.clipboard.wordcount: 19
-.documents.1.co: 9
-.documents.1.cp: 71
-.documents.1.cw: 4
+.documents.1.co: 10
+.documents.1.cp: 39
+.documents.1.cw: 5
.documents.1.margin: 0
.documents.1.name: "main"
.documents.1.sticky_selection: false
@@ -166,12 +166,12 @@ H2 Local version of C4
P The local version of C4 has the following adaoptions and extensions:
LB switch statement from the switch-and-structs branch, adapted c4 itself to use switch statements instead of if's (as in the switch-and-structs branch)
LB struct support from switch-and-structs
-LB constants like EOF, EXIT_SUCCESS, NULL
+LB constants like EOF, EXIT_SUCCESS, NULL
LB standard C block comments along to c++ end of line ones
LB negative enum initializers
LB do/while loops
-LB more C functions like isspace, getc, strcmp
-LB some simplified functions for printing like putstring, putint, putnl
+LB more C functions like isspace, getc, strcmp
+LB some simplified functions for printing like putstring, putint, putnl
LB strict C89 conformance, mainly use standard comment blocks, also removed some warnings
LB some casts around malloc and memset to fit to non-void freestanding-libc
LB converted printf to putstring/putint/putnl and some helper functions for error reporting like error()