diff options
Diffstat (limited to 'miniany/README.html')
-rw-r--r-- | miniany/README.html | 40 |
1 files changed, 26 insertions, 14 deletions
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 \< test1.c \> 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 \< test1.c \> 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 "\034" \> 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 "\034" \> 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> |