summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-08-05 21:34:13 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2021-08-05 21:34:13 +0200
commit7d0ea16a2c64883810f57b05d864837ddd724441 (patch)
tree1210fa62f4a0b3c137d824a89d25c052aab12108
parentb41a259e3f43d1a4ede320fa54e5e7b0f0a551fd (diff)
downloadcompilertests-7d0ea16a2c64883810f57b05d864837ddd724441.tar.gz
compilertests-7d0ea16a2c64883810f57b05d864837ddd724441.tar.bz2
added quite some links around c4
-rw-r--r--miniany/README58
-rw-r--r--miniany/REQUIREMENTS2
-rw-r--r--miniany/hello.c7
3 files changed, 48 insertions, 19 deletions
diff --git a/miniany/README b/miniany/README
index 137a88d..fcd9e06 100644
--- a/miniany/README
+++ b/miniany/README
@@ -1,22 +1,44 @@
-Building
---------
+# Building
+```
./build.sh cc tcc hosted d
./build.sh cc tcc freestanding d
+```
-Acknoledgments
---------------
-
-c4 - C in four functions
-minimalistic C compiler running on an emulator, inspiration for this
-project
-https://github.com/rswier/c4.git
-adaptions to provide switch and structs:
-https://github.com/rswier/c4/blob/switch-and-structs/c4.c: structs
-https://github.com/EarlGray/c4, a X86 JIT version of c4
-https://github.com/jserv/amacc: based on C4, JIT or native code, for ARM
-
-selfie
-C* self-hosting C compiler (also emulator, hypervisor) for RISCV,
-inspiration for what makes up a minimal C language,
-http://selfie.cs.uni-salzburg.at/
+# Running on c4:
+
+```
+tcc -O0 -g -o c4 c4.c
+./c4 cc.c < hello.c
+./c4 c4.c cc.c < hello.c
+./c4 c4.c c4.c cc.c < hello.c
+```
+
+# Acknoledgments and references
+
+* c4
+ * https://github.com/rswier/c4.git
+ c4 - C in four functions
+ minimalistic C compiler running on an emulator on the IR, inspiration
+ for this project
+ * https://github.com/rswier/c4/blob/switch-and-structs/c4.c:
+ c4 adaptions to provide switch and structs:
+ * https://github.com/EarlGray/c4: a X86 JIT version of c4
+ * https://github.com/jserv/amacc: based on C4, JIT or native code, for
+ ARM, quite well documented, also very nice list of compiler
+ resources on Github page
+
+* selfie
+ * http://selfie.cs.uni-salzburg.at/:
+ C* self-hosting C compiler (also emulator, hypervisor) for RISCV,
+ inspiration for what makes up a minimal C language
+
+* tiny.c
+ * http://www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c
+
+* c.c in swieros: https://github.com/rswier/swieros.git
+
+* documentation
+ * "Compiler Construction", Niklaus Wirth
+ * https://github.com/DoctorWkt/acwj
+
diff --git a/miniany/REQUIREMENTS b/miniany/REQUIREMENTS
index 0352078..474e975 100644
--- a/miniany/REQUIREMENTS
+++ b/miniany/REQUIREMENTS
@@ -13,6 +13,7 @@ not implementing:
- printf
- format string only, as replacement for puts
- vararg required in compiler
+ - not type-safe
- puts
- requires stdout, which is a FILE structure
- print_char
@@ -28,4 +29,3 @@ not implementing:
- linker
- have compilation units needs a linker do build
an executable
-
diff --git a/miniany/hello.c b/miniany/hello.c
new file mode 100644
index 0000000..ab06506
--- /dev/null
+++ b/miniany/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("hello, world\n");
+ return 0;
+}