summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-08-01 07:46:08 +0000
committerAndreas Baumann <mail@andreasbaumann.cc>2021-08-01 07:46:08 +0000
commitb41a259e3f43d1a4ede320fa54e5e7b0f0a551fd (patch)
tree5d8d579c10495384b90e41ec0afe2d5a6b5a5fe6
parentb1164d69ea2fc694c4cabdbdee6f4155684ce322 (diff)
downloadcompilertests-b41a259e3f43d1a4ede320fa54e5e7b0f0a551fd.tar.gz
compilertests-b41a259e3f43d1a4ede320fa54e5e7b0f0a551fd.tar.bz2
added normal comments to c4
-rw-r--r--miniany/README1
-rw-r--r--miniany/TODOS12
-rw-r--r--miniany/c4.c9
3 files changed, 22 insertions, 0 deletions
diff --git a/miniany/README b/miniany/README
index deb195b..137a88d 100644
--- a/miniany/README
+++ b/miniany/README
@@ -14,6 +14,7 @@ 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,
diff --git a/miniany/TODOS b/miniany/TODOS
new file mode 100644
index 0000000..ed6e09e
--- /dev/null
+++ b/miniany/TODOS
@@ -0,0 +1,12 @@
+- avoid inline assembler, have more a inline bytecode adder
+ explicit opcodes, e.g. nop -> .byte 0x90
+- read -1 problem is the c4.c as interpreter reading behaving wrongly
+ because -1 is wrongly handled in integer parsing
+- variadic functions are not type-safe, do we need them?
+ - printf -> putint, putchar, etc.
+ - snprintf no option, strcat, strstr etc also not really
+ - newer formating functions and logging: strfmon, error, warn, syslog
+ - syscall
+
+
+
diff --git a/miniany/c4.c b/miniany/c4.c
index d8a588a..a3cc0ff 100644
--- a/miniany/c4.c
+++ b/miniany/c4.c
@@ -97,6 +97,15 @@ void next()
++p;
while (*p != 0 && *p != '\n') ++p;
}
+ else if (*p != 0 && *p == '*') {
+ ++p;
+ while (*p != 0 && *p != '/') {
+ if (*p == '\n') line++;
+ if (*p == '*');
+ ++p;
+ }
+ ++p;
+ }
else {
tk = Div;
return;