mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-01-09 10:30:13 +00:00
Remove the need for parens in vector (routine ...) table
type.
This commit is contained in:
parent
5c3c560fe4
commit
08ec0e46a3
@ -10,6 +10,8 @@ History of SixtyPical
|
||||
* Implements the "union rule for trashes" when analyzing `if` blocks.
|
||||
* Even if we `goto` another routine, we can't trash an output.
|
||||
* `static` storage locations local to routines can now be defined within routines.
|
||||
* Small grammar change that obviates the need for parentheses in the type expression
|
||||
`vector (routine ...) table`.
|
||||
* Fixed bug where `trash` was not marking the location as being virtually altered.
|
||||
|
||||
0.11
|
||||
|
@ -67,11 +67,12 @@ is probably NP-complete. But doing it adeuqately is probably not that hard.
|
||||
### And at some point...
|
||||
|
||||
* `const`s that can be used in defining the size of tables, etc.
|
||||
* Remove the need for `forward` and `vector () table` (make grammar changes)
|
||||
* Remove the need for `forward` (lots of backpatching)
|
||||
* Tests, and implementation, ensuring a routine can be assigned to a vector of "wider" type
|
||||
* Check that the buffer being read or written to through pointer, appears in approporiate inputs or outputs set.
|
||||
(Associate each pointer with the buffer it points into.)
|
||||
* `static` pointers -- currently not possible because pointers must be zero-page, thus `@`, thus uninitialized.
|
||||
* Question the value of the "consistent initialization" principle for `if` statement analysis.
|
||||
* `interrupt` routines -- to indicate that "the supervisor" has stored values on the stack, so we can trash them.
|
||||
* Error messages that include the line number of the source code.
|
||||
* Add absolute addressing in shl/shr, absolute-indexed for add, sub, etc.
|
||||
|
@ -537,13 +537,14 @@ Grammar
|
||||
Program ::= {TypeDefn} {Defn} {Routine}.
|
||||
TypeDefn::= "typedef" Type Ident<new>.
|
||||
Defn ::= Type Ident<new> [Constraints] (":" Literal | "@" LitWord).
|
||||
Type ::= "(" Type ")" | TypeExpr ["table" TypeSize].
|
||||
Type ::= TypeTerm ["table" TypeSize].
|
||||
TypeExpr::= "byte"
|
||||
| "word"
|
||||
| "buffer" TypeSize
|
||||
| "pointer"
|
||||
| "vector" Type
|
||||
| "vector" TypeTerm
|
||||
| "routine" Constraints
|
||||
| "(" Type ")"
|
||||
.
|
||||
TypeSize::= "[" LitWord "]".
|
||||
Constrnt::= ["inputs" LocExprs] ["outputs" LocExprs] ["trashes" LocExprs].
|
||||
|
@ -87,7 +87,7 @@ word new_pos
|
||||
word table[256] actor_delta
|
||||
word delta
|
||||
|
||||
vector (logic_routine) table[256] actor_logic
|
||||
vector logic_routine table[256] actor_logic
|
||||
vector logic_routine dispatch_logic
|
||||
|
||||
byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
||||
|
@ -136,6 +136,15 @@ class Parser(object):
|
||||
return size
|
||||
|
||||
def defn_type(self):
|
||||
type_ = self.defn_type_term()
|
||||
|
||||
if self.scanner.consume('table'):
|
||||
size = self.defn_size()
|
||||
type_ = TableType(type_, size)
|
||||
|
||||
return type_
|
||||
|
||||
def defn_type_term(self):
|
||||
type_ = None
|
||||
|
||||
if self.scanner.consume('('):
|
||||
@ -148,7 +157,7 @@ class Parser(object):
|
||||
elif self.scanner.consume('word'):
|
||||
type_ = TYPE_WORD
|
||||
elif self.scanner.consume('vector'):
|
||||
type_ = self.defn_type()
|
||||
type_ = self.defn_type_term()
|
||||
if not isinstance(type_, RoutineType):
|
||||
raise SyntaxError("Vectors can only be of a routine, not %r" % type_)
|
||||
type_ = VectorType(type_)
|
||||
@ -167,10 +176,6 @@ class Parser(object):
|
||||
raise SyntaxError("Undefined type '%s'" % type_name)
|
||||
type_ = self.typedefs[type_name]
|
||||
|
||||
if self.scanner.consume('table'):
|
||||
size = self.defn_size()
|
||||
type_ = TableType(type_, size)
|
||||
|
||||
return type_
|
||||
|
||||
def defn_name(self):
|
||||
|
@ -634,9 +634,9 @@ Copying to and from a vector table.
|
||||
| outputs x
|
||||
| trashes a, z, n
|
||||
| one
|
||||
| vector (routine
|
||||
| vector routine
|
||||
| outputs x
|
||||
| trashes a, z, n)
|
||||
| trashes a, z, n
|
||||
| table[256] many
|
||||
|
|
||||
| routine bar outputs x trashes a, z, n {
|
||||
|
Loading…
Reference in New Issue
Block a user