about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-18 16:21:53 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-18 16:22:04 -0700
commit220575dc4a70228438ed6f4a10324f5669277044 (patch)
tree0422b5f1efe0ea99c839cde53f775672b888616f
parentf09280141f18fbe8cef0ed576cf932e12e315666 (diff)
downloadmu-220575dc4a70228438ed6f4a10324f5669277044.tar.gz
4549 - RIP transect
-rw-r--r--transect/Readme6
-rw-r--r--transect/compiler103
2 files changed, 9 insertions, 0 deletions
diff --git a/transect/Readme b/transect/Readme
new file mode 100644
index 00000000..821ccde0
--- /dev/null
+++ b/transect/Readme
@@ -0,0 +1,6 @@
+Abortive series of attempts at building a bootstrappable low-level language.
+Type-checked, but feasible to implement in some sort of notation for machine
+code (like SubX).
+
+The latest version is in compiler10. But it doesn't account for checking
+how programs allocate registers.
diff --git a/transect/compiler10 b/transect/compiler10
index 37cf67ab..ce0e487a 100644
--- a/transect/compiler10
+++ b/transect/compiler10
@@ -132,6 +132,9 @@ Operands are always scalar. Variables on the stack or global segment are immutab
   - Variables on the stack are stored at addresses like *(EBP+n)
   - Global variables are stored at addresses like *disp32, where disp32 is a statically known constant
 
+  #define local(n)  1/mod 4/rm32/SIB 5/base/EBP 4/index/none 0/scale n/disp8
+  #define disp32(N) 0/mod 5/rm32/include-disp32 N/disp32
+
 Since the language will not be orthogonal, compilation proceeds by pattern matching over a statement along with knowledge about the types of its operands, as well as where they're stored (register/stack/global). We now enumerate mappings for various categories of statements, based on the type and location of their operands.
 
 Many statements will end up encoding to the exact same x86 instructions. But the types differ, and they get type-checked differently along the way.