From b41a259e3f43d1a4ede320fa54e5e7b0f0a551fd Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 1 Aug 2021 07:46:08 +0000 Subject: added normal comments to c4 --- miniany/README | 1 + miniany/TODOS | 12 ++++++++++++ miniany/c4.c | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 miniany/TODOS 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; -- cgit v1.2.3-54-g00ecf