Yet more TODO notes.
Chris Pressey
4 years ago
85 | 85 | It might make more sense, then, for it to be "part of the operation" instead of "part of |
86 | 86 | the reference"; something like `st.hi x, word`; `st.lo y, word`. Dunno. |
87 | 87 | |
88 | ### Save registers on stack | |
88 | ### Save values | |
89 | 89 | |
90 | 90 | This preserves them, so that, semantically, they can be used later even though they |
91 | are trashed inside the block. | |
91 | are trashed (or otherwise alternately used) inside the block. | |
92 | ||
93 | Inside the block, we set them as writeable (but not meaningful). When the block | |
94 | exits, we restore whatever status they had. | |
95 | ||
96 | This act will trash `a`, both in the block, and outside it, unless the value being | |
97 | saved is `a`. One idiom would be something like | |
98 | ||
99 | save a { save var { | |
100 | ... | |
101 | } } | |
102 | ||
103 | which would save all values. Maybe abbreviate this to | |
104 | ||
105 | save a, var { | |
106 | ... | |
107 | } | |
108 | ||
109 | This can use the stack. But it need not use the stack. | |
110 | ||
111 | ### Make all symbols forward-referencable | |
112 | ||
113 | Basically, don't do symbol-table lookups when parsing, but do have a more formal | |
114 | "symbol resolution" (linking) phase right after parsing. | |
92 | 115 | |
93 | 116 | ### Associate each pointer with the buffer it points into |
94 | 117 | |
102 | 125 | |
103 | 126 | When we read through the pointer, we need to check that the buffer is readable. |
104 | 127 | |
105 | ### table overlays | |
128 | ### Table overlays | |
106 | 129 | |
107 | 130 | They are uninitialized, but the twist is, the address is a buffer that is |
108 | 131 | an input to and/or output of the routine. So, they are defined (insofar |
126 | 149 | |
127 | 150 | Question the value of the "consistent initialization" principle for `if` statement analysis. |
128 | 151 | |
152 | Part of this is the trashes at the end; I think what it should be is that the trashes | |
153 | after the `if` is the union of the trashes in each of the branches; this would obviate the | |
154 | need to `trash` values explicitly, but if you tried to access them afterwards, it would still | |
155 | error. | |
156 | ||
129 | 157 | ### Tail-call optimization |
130 | 158 | |
131 | 159 | More generally, define a block as having zero or one `goto`s at the end. (and `goto`s cannot |
137 | 165 | And - once we have this - why do we need `goto` to be in tail position, strictly? |
138 | 166 | As long as the routine has consistent type context every place it exits, that should be fine. |
139 | 167 | |
140 | ### Include pragmas | |
168 | ### "Include" directives | |
141 | 169 | |
142 | 170 | Search a searchlist of include paths. And use them to make libraries of routines. |
143 | 171 |