[fpc-pascal] ordinal-type

Adriaan van Os adriaan at adriaan.biz
Tue Dec 19 11:09:27 CET 2023


Michael Van Canneyt wrote:

>> 29. Am I correct to assume ?
>>
>>     ordinal-type = ordinal-type-identifier .
>>     ordinal-type-identifier = identifier .
> 
> Yes.

That may not be correct after-all, because an <ordinal-type> e.g. indexes arrays

	array-type = [ "PACKED" | "bitpacked" ] "ARRAY" [ "[" ordinal-type { "," ordinal-type } "]" ] "OF" 
type .

In ISO-7185 Pascal we have

   array-type = "array" "[" index-type { "," index-type } "]" "of" component-type .
   index-type = ordinal-type .
   ordinal-type = new-ordinal-type | ordinal-type-identifier .
   new-ordinal-type = enumerated-type | subrange-type .
   enumerated-type = "(" identifier-list ")" .
   subrange-type = constant ".." constant .

And in the FreePascal Language Reference <subrange-type> seems not to be referenced by any other rule.

	subrange-type = constant ".." constant .

I suggest to change <ordinal-type> to

	ordinal-type = ordinal-type-identifier | subrange-type | enumerated-type .

Regards,

Adriaan van Os



More information about the fpc-pascal mailing list