summaryrefslogtreecommitdiff
path: root/miniany/cc.wg
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2024-01-14 19:46:20 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2024-01-14 19:46:20 +0100
commit41568587eaee36488b70e6e76b2f9ea68890471e (patch)
tree87bf362dd5bad006d96983f6848bb3c878b59a2e /miniany/cc.wg
parent7bde6411b1b82cafd997df8ac222e82280a6e786 (diff)
downloadcompilertests-41568587eaee36488b70e6e76b2f9ea68890471e.tar.gz
compilertests-41568587eaee36488b70e6e76b2f9ea68890471e.tar.bz2
updated todos and documentation
Diffstat (limited to 'miniany/cc.wg')
-rw-r--r--miniany/cc.wg86
1 files changed, 48 insertions, 38 deletions
diff --git a/miniany/cc.wg b/miniany/cc.wg
index b546c7c..0103123 100644
--- a/miniany/cc.wg
+++ b/miniany/cc.wg
@@ -29,24 +29,19 @@ WordGrinder dumpfile v3: this is a text file; diff me!
.clipboard.margin: 0
.clipboard.viewmode: 1
.clipboard.wordcount: 3
-.documents.1.co: 6
-.documents.1.cp: 244
-.documents.1.cw: 2
+.documents.1.co: 9
+.documents.1.cp: 228
+.documents.1.cw: 1
.documents.1.margin: 0
.documents.1.name: "main"
.documents.1.sticky_selection: false
.documents.1.viewmode: 1
-.documents.1.wordcount: 3192
+.documents.1.wordcount: 3376
.fileformat: 8
.findtext: "geneate"
-.menu.accelerators.^@: "ZM"
-.menu.accelerators.^B: "SB"
.menu.accelerators.BACKSPACE: "ZDPC"
-.menu.accelerators.^C: "EC"
.menu.accelerators.DELETE: "ZDNC"
-.menu.accelerators.^DOWN: "ZNP"
.menu.accelerators.DOWN: "ZD"
-.menu.accelerators.^E: "ZDW"
.menu.accelerators.EC: "^C"
.menu.accelerators.ECadd: "^M"
.menu.accelerators.ECfind: "^L"
@@ -56,58 +51,36 @@ WordGrinder dumpfile v3: this is a text file; diff me!
.menu.accelerators.END: "ZE"
.menu.accelerators.EP: "^V"
.menu.accelerators.ER: "^R"
-.menu.accelerators.Eredo: "^Y"
.menu.accelerators.ET: "^X"
+.menu.accelerators.Eredo: "^Y"
.menu.accelerators.Eundo: "^Z"
-.menu.accelerators.^F: "EF"
.menu.accelerators.FQ: "^Q"
.menu.accelerators.FS: "^S"
-.menu.accelerators.^G: "EG"
.menu.accelerators.HOME: "ZH"
-.menu.accelerators.^I: "SI"
-.menu.accelerators.^K: "EN"
-.menu.accelerators.^L: "ECfind"
-.menu.accelerators.^LEFT: "ZWL"
.menu.accelerators.LEFT: "ZL"
-.menu.accelerators.^M: "ECadd"
-.menu.accelerators.^O: "SO"
-.menu.accelerators.^P: "SP"
-.menu.accelerators.^PGDN: "ZED"
.menu.accelerators.PGDN: "ZPGDN"
-.menu.accelerators.^PGUP: "ZBD"
.menu.accelerators.PGUP: "ZPGUP"
-.menu.accelerators.^Q: "FQ"
-.menu.accelerators.^R: "ER"
-.menu.accelerators.^RIGHT: "ZWR"
.menu.accelerators.RIGHT: "ZR"
-.menu.accelerators.^S: "FS"
.menu.accelerators.SB: "^B"
-.menu.accelerators.S^DOWN: "ZSNP"
.menu.accelerators.SDOWN: "ZSD"
.menu.accelerators.SEND: "ZSE"
.menu.accelerators.SHOME: "ZSH"
.menu.accelerators.SI: "^I"
-.menu.accelerators.S^LEFT: "ZSWL"
.menu.accelerators.SLEFT: "ZSL"
.menu.accelerators.SO: "^O"
.menu.accelerators.SP: "^P"
-.menu.accelerators.S^PGDN: "ZSED"
.menu.accelerators.SPGDN: "ZSPGDN"
-.menu.accelerators.S^PGUP: "ZSBD"
.menu.accelerators.SPGUP: "ZSPGUP"
-.menu.accelerators.S^RIGHT: "ZSWR"
.menu.accelerators.SRIGHT: "ZSR"
.menu.accelerators.SU: "^U"
-.menu.accelerators.S^UP: "ZSPP"
.menu.accelerators.SUP: "ZSU"
-.menu.accelerators.^U: "SU"
-.menu.accelerators.^UP: "ZPP"
+.menu.accelerators.S^DOWN: "ZSNP"
+.menu.accelerators.S^LEFT: "ZSWL"
+.menu.accelerators.S^PGDN: "ZSED"
+.menu.accelerators.S^PGUP: "ZSBD"
+.menu.accelerators.S^RIGHT: "ZSWR"
+.menu.accelerators.S^UP: "ZSPP"
.menu.accelerators.UP: "ZU"
-.menu.accelerators.^V: "EP"
-.menu.accelerators.^W: "ZSW"
-.menu.accelerators.^X: "ET"
-.menu.accelerators.^Y: "Eredo"
-.menu.accelerators.^Z: "Eundo"
.menu.accelerators.ZBD: "^PGUP"
.menu.accelerators.ZD: "DOWN"
.menu.accelerators.ZDNC: "DELETE"
@@ -141,6 +114,33 @@ WordGrinder dumpfile v3: this is a text file; diff me!
.menu.accelerators.ZU: "UP"
.menu.accelerators.ZWL: "^LEFT"
.menu.accelerators.ZWR: "^RIGHT"
+.menu.accelerators.^@: "ZM"
+.menu.accelerators.^B: "SB"
+.menu.accelerators.^C: "EC"
+.menu.accelerators.^DOWN: "ZNP"
+.menu.accelerators.^E: "ZDW"
+.menu.accelerators.^F: "EF"
+.menu.accelerators.^G: "EG"
+.menu.accelerators.^I: "SI"
+.menu.accelerators.^K: "EN"
+.menu.accelerators.^L: "ECfind"
+.menu.accelerators.^LEFT: "ZWL"
+.menu.accelerators.^M: "ECadd"
+.menu.accelerators.^O: "SO"
+.menu.accelerators.^P: "SP"
+.menu.accelerators.^PGDN: "ZED"
+.menu.accelerators.^PGUP: "ZBD"
+.menu.accelerators.^Q: "FQ"
+.menu.accelerators.^R: "ER"
+.menu.accelerators.^RIGHT: "ZWR"
+.menu.accelerators.^S: "FS"
+.menu.accelerators.^U: "SU"
+.menu.accelerators.^UP: "ZPP"
+.menu.accelerators.^V: "EP"
+.menu.accelerators.^W: "ZSW"
+.menu.accelerators.^X: "ET"
+.menu.accelerators.^Y: "Eredo"
+.menu.accelerators.^Z: "Eundo"
.name: "/home/abaumann/projects/compilertests/miniany/cc.wg"
.replacetext: ""
.statusbar: true
@@ -371,6 +371,15 @@ P Reasoning:
LB Adding putint/getchar style of functions as elements of the language is tempting, as it allows early debugging and testing (as in PASCAL). The fundemental conflict here is that bootstrapping is better with stdout and stdin in the language (no function calls, no linker, etc. needed). But later on we want those functions be part of a language library and not of the language itself.
P Caveats:
LB Avoid code duplication (inline assembly in the compiler for the keyword implementation and with inline assembly in the language library). (TODO)
+H3 Function calling conventions
+P Implementation status: yes
+P Reasoning:
+LB Calling conventions, EAX for int or pointer returns, stack as in Pascal in calling order (otherwise we need an AST of the parameters if we want to push them in reverse order). Reverse order is there so that the first parameter is on top of the stack and we now the start of the stack frame, this helps implementing varargs, which we don't want to support.
+LB Currently we only have ints, chars and pointers, which should fit nicely into simple memory models where pointers and integers are not completely different. char/byte arguments can be pushed as 4-bytes, we could do some stack alignment to simplify things.
+P Caveats:
+LB Operating syscalls follow the EAX, EBX, ECX, EDX, .. int 80h calls on the 32-bit host. There might be our own operating syscalls we want to support later. The compiler should not know about that and a thin layer in the standard library can do the conversion.
+P Counter arguments:
+LB thiscall conventions would be handy if we had some limited C++ this pointer support.
H2 References
P Compiler construction in general:
LB "Compiler Construction"", Niklaus Wirth
@@ -379,6 +388,7 @@ LB https://github.com/lotabout/write-a-C-interpreter/blob/master/tutorial/en/, t
P Some special compiler building topics:
LB https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm#climbing, https://en.wikipedia.org/wiki/Operator-precedence_parser#Precedence_climbing_method
LB https://en.wikipedia.org/wiki/Strahler_number: justification for register numbers for register alloation (TODO: clarify)
+LB https://en.wikipedia.org/wiki/X86_calling_conventions: calling conventions on the IA-32 architecture
P C4:
LB https://github.com/rswier/c4.git, C4 - C in four functions, Robert Swierczek, minimalistic C compiler running on an emulator on the IR, inspiration for this project
LB https://github.com/rswier/c4/blob/switch-and-structs/c4.c, c4 adaptions to provide switch and structs