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.
24 -0400 snapshot of project "lynx", label v2_6' href='/ingrix/lynx-snapshots/commit/src/LYEdit.c?id=e087f6d44e87f489fcb3056e86319ebba4218156'>e087f6d4
e087f6d4
57bfc74f ^




e087f6d4
57bfc74f ^



e087f6d4
57bfc74f ^



e087f6d4
57bfc74f ^



0eae931d ^
57bfc74f ^

e087f6d4
57bfc74f ^





e087f6d4
57bfc74f ^





2a94396c ^
57bfc74f ^




e087f6d4
b6d1143c ^

2a94396c ^
b6d1143c ^
e4409c40 ^

aa3258c6 ^
e4409c40 ^
e087f6d4
aa3258c6 ^
e087f6d4
aa3258c6 ^
e087f6d4
e4409c40 ^
aa3258c6 ^
57bfc74f ^


e087f6d4
2a94396c ^
57bfc74f ^
e087f6d4
57bfc74f ^

e087f6d4
b6d1143c ^


e4409c40 ^
aa3258c6 ^
e4409c40 ^
e087f6d4
aa3258c6 ^
e087f6d4
aa3258c6 ^
e087f6d4
e4409c40 ^
aa3258c6 ^
0eae931d ^
57bfc74f ^


e087f6d4

57bfc74f ^









e087f6d4
57bfc74f ^








e087f6d4
57bfc74f ^





e4409c40 ^
b6d1143c ^
e4409c40 ^
b6d1143c ^
e4409c40 ^
57bfc74f ^
b6c832d0 ^
b6d1143c ^
b6c832d0 ^
57bfc74f ^
e4409c40 ^




b6c832d0 ^
e087f6d4
0eae931d ^

2a94396c ^
57bfc74f ^
2a94396c ^
e087f6d4
57bfc74f ^


57bfc74f ^
5816641f ^
57bfc74f ^
e087f6d4
57bfc74f ^





e087f6d4

57bfc74f ^





e087f6d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182