1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-29 03:51:35 +00:00

I can no longer see a reason to require that it is a power of two.

This commit is contained in:
Chris Pressey 2018-03-05 10:38:20 +00:00
parent a115c2bc9f
commit d24e9fa2e1
3 changed files with 16 additions and 16 deletions

View File

@ -25,7 +25,7 @@ There are five *primitive types* in SixtyPical:
There are also three *type constructors*: There are also three *type constructors*:
* T table[N] (N is a power of 2, 1 ≤ N ≤ 256; each entry holds a value * T table[N] (N entries, 1 ≤ N ≤ 256; each entry holds a value
of type T, where T is `byte`, `word`, or `vector`) of type T, where T is `byte`, `word`, or `vector`)
* buffer[N] (N entries; each entry is a byte; 1 ≤ N ≤ 65536) * buffer[N] (N entries; each entry is a byte; 1 ≤ N ≤ 65536)
* vector T (address of a value of type T; T must be a routine type) * vector T (address of a value of type T; T must be a routine type)

View File

@ -146,7 +146,7 @@ class Parser(object):
if self.scanner.consume('table'): if self.scanner.consume('table'):
size = self.defn_size() size = self.defn_size()
if size not in (1, 2, 4, 8, 16, 32, 64, 129, 256): if size <= 0 or size > 256:
raise SyntaxError("Table size must be a power of two, 0 < size <= 256") raise SyntaxError("Table size must be a power of two, 0 < size <= 256")
type_ = TableType(type_, size) type_ = TableType(type_, size)

View File

@ -153,8 +153,8 @@ Tables of different types.
| } | }
= ok = ok
The number of entries in a table must be a power of two The number of entries in a table must be
which is greater than 0 and less than or equal to 256. greater than 0 and less than or equal to 256.
| word table[512] many | word table[512] many
| |
@ -168,18 +168,6 @@ which is greater than 0 and less than or equal to 256.
| } | }
? SyntaxError ? SyntaxError
| word table[48] many
|
| routine main
| inputs many
| outputs many
| trashes a, x, n, z
| {
| ld x, 0
| copy 9999, many + x
| }
? SyntaxError
| word table[0] many | word table[0] many
| |
| routine main | routine main
@ -192,6 +180,18 @@ which is greater than 0 and less than or equal to 256.
| } | }
? SyntaxError ? SyntaxError
| word table[48] many
|
| routine main
| inputs many
| outputs many
| trashes a, x, n, z
| {
| ld x, 0
| copy 9999, many + x
| }
= ok
Typedefs of different types. Typedefs of different types.
| typedef byte octet | typedef byte octet