Remove the need for parens in `vector (routine ...) table` type.
Chris Pressey
7 years ago
9 | 9 |
* Implements the "union rule for trashes" when analyzing `if` blocks.
|
10 | 10 |
* Even if we `goto` another routine, we can't trash an output.
|
11 | 11 |
* `static` storage locations local to routines can now be defined within routines.
|
|
12 |
* Small grammar change that obviates the need for parentheses in the type expression
|
|
13 |
`vector (routine ...) table`.
|
12 | 14 |
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
13 | 15 |
|
14 | 16 |
0.11
|
66 | 66 |
### And at some point...
|
67 | 67 |
|
68 | 68 |
* `const`s that can be used in defining the size of tables, etc.
|
69 | |
* Remove the need for `forward` and `vector () table` (make grammar changes)
|
|
69 |
* Remove the need for `forward` (lots of backpatching)
|
70 | 70 |
* Tests, and implementation, ensuring a routine can be assigned to a vector of "wider" type
|
71 | 71 |
* Check that the buffer being read or written to through pointer, appears in approporiate inputs or outputs set.
|
72 | 72 |
(Associate each pointer with the buffer it points into.)
|
73 | 73 |
* `static` pointers -- currently not possible because pointers must be zero-page, thus `@`, thus uninitialized.
|
|
74 |
* Question the value of the "consistent initialization" principle for `if` statement analysis.
|
74 | 75 |
* `interrupt` routines -- to indicate that "the supervisor" has stored values on the stack, so we can trash them.
|
75 | 76 |
* Error messages that include the line number of the source code.
|
76 | 77 |
* Add absolute addressing in shl/shr, absolute-indexed for add, sub, etc.
|
536 | 536 |
Program ::= {TypeDefn} {Defn} {Routine}.
|
537 | 537 |
TypeDefn::= "typedef" Type Ident<new>.
|
538 | 538 |
Defn ::= Type Ident<new> [Constraints] (":" Literal | "@" LitWord).
|
539 | |
Type ::= "(" Type ")" | TypeExpr ["table" TypeSize].
|
|
539 |
Type ::= TypeTerm ["table" TypeSize].
|
540 | 540 |
TypeExpr::= "byte"
|
541 | 541 |
| "word"
|
542 | 542 |
| "buffer" TypeSize
|
543 | 543 |
| "pointer"
|
544 | |
| "vector" Type
|
|
544 |
| "vector" TypeTerm
|
545 | 545 |
| "routine" Constraints
|
|
546 |
| "(" Type ")"
|
546 | 547 |
.
|
547 | 548 |
TypeSize::= "[" LitWord "]".
|
548 | 549 |
Constrnt::= ["inputs" LocExprs] ["outputs" LocExprs] ["trashes" LocExprs].
|
86 | 86 |
word table[256] actor_delta
|
87 | 87 |
word delta
|
88 | 88 |
|
89 | |
vector (logic_routine) table[256] actor_logic
|
|
89 |
vector logic_routine table[256] actor_logic
|
90 | 90 |
vector logic_routine dispatch_logic
|
91 | 91 |
|
92 | 92 |
byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
135 | 135 |
return size
|
136 | 136 |
|
137 | 137 |
def defn_type(self):
|
|
138 |
type_ = self.defn_type_term()
|
|
139 |
|
|
140 |
if self.scanner.consume('table'):
|
|
141 |
size = self.defn_size()
|
|
142 |
type_ = TableType(type_, size)
|
|
143 |
|
|
144 |
return type_
|
|
145 |
|
|
146 |
def defn_type_term(self):
|
138 | 147 |
type_ = None
|
139 | 148 |
|
140 | 149 |
if self.scanner.consume('('):
|
|
147 | 156 |
elif self.scanner.consume('word'):
|
148 | 157 |
type_ = TYPE_WORD
|
149 | 158 |
elif self.scanner.consume('vector'):
|
150 | |
type_ = self.defn_type()
|
|
159 |
type_ = self.defn_type_term()
|
151 | 160 |
if not isinstance(type_, RoutineType):
|
152 | 161 |
raise SyntaxError("Vectors can only be of a routine, not %r" % type_)
|
153 | 162 |
type_ = VectorType(type_)
|
|
165 | 174 |
if type_name not in self.typedefs:
|
166 | 175 |
raise SyntaxError("Undefined type '%s'" % type_name)
|
167 | 176 |
type_ = self.typedefs[type_name]
|
168 | |
|
169 | |
if self.scanner.consume('table'):
|
170 | |
size = self.defn_size()
|
171 | |
type_ = TableType(type_, size)
|
172 | 177 |
|
173 | 178 |
return type_
|
174 | 179 |
|