For a library defined type to define bindings to operators and pervasive functions it must be declared as a subset of one of six semantic superset types:
The syntax is defined as:
recordType : RECORD ( '(' semanticType | baseType ')' )? fieldListSequence? END ; opaquePointerType : OPAQUE ( '(' semanticType ')' )?; semanticType : string ; // "A-Type" and "S-Type" for opaque pointers // "Z-Type", "R-Type", "C-Type", "V-Type" for records
The verification of operator bindings depends on the semantic type that a library type is declared a subset of. It is a compile time error to declare a binding for an operator or pervasive function that is not permitted by the type's semantic superset type.
The bindings permitted for each semantic type are listed below:
The following bindings are permitted:
[NIL]
null key value
[NEW]
constructor
[DISPOSE]
destructor
[COUNT]
number of entries
[FOR]
iterator
[IN]
membership test
[.]
entry accessor
[!]
entry mutator
[-]
entry removal
Example: SampleCollection
The following bindings are permitted:
[NEW]
constructor
[DISPOSE]
destructor
[LENGTH]
length
[:=]
literal assignment
[::]
type conversion
[+]
concatenation
[=]
equality
[<]
lower in collating sequence
[>]
higher in collating sequence
Example: STRING
The following bindings are permitted:
[TMIN]
minimum value
[TMAX]
maximum value
[ABS]
absolute value
[NEG]
sign reversal
[ODD]
odd or even
[:=]
literal assignment
[::]
type conversion
[+]
addition
[-]
subtraction
[*]
multiplication
[DIV]
division
[MOD]
modulo
[=]
equality
[<]
less than
[>]
greater than
[TO]
scalar conversion primitive
[FROM]
scalar conversion primitive
Examples: SampleUINT
and SampleINT
The following bindings are permitted:
[TMIN]
minimum value
[TMAX]
maximum value
[ABS]
absolute value
[NEG]
sign reversal
[:=]
literal assignment
[::]
type conversion
[+]
addition
[-]
subtraction
[*]
multiplication
[/]
division
[=]
equality
[<]
less than
[>]
greater than
[TO]
scalar conversion primitive
[FROM]
scalar conversion primitive
Example: BCD
The following bindings are permitted:
[ABS]
absolute value
[NEG]
sign reversal
[::]
type conversion
[+]
addition
[-]
subtraction
[*]
multiplication
[/]
division
[=]
equality
Example: COMPLEX
The following bindings are permitted:
[HIGH]
highest component index
[ABS]
absolute value
[NEG]
sign reversal
[.]
component accessor
[!]
component mutator
[::]
type conversion
[+]
addition
[-]
subtraction
[=]
equality
Example: SampleVector
and SampleTuple
The following constraints are common to all semantic types:
S-Type | Z-Type | R-Type | C-Type | V-Type | Collection | |
---|---|---|---|---|---|---|
TMIN | — | yes | yes | — | — | — |
TMAX | — | yes | yes | — | — | — |
HIGH | — | — | — | — | yes | — |
LENGTH | yes | — | — | — | — | — |
COUNT | — | — | — | — | — | yes |
ABS | — | yes | yes | yes | yes | — |
NEG | — | yes | yes | yes | yes | — |
ODD | — | yes | — | — | — | — |
DIV | — | yes | — | — | — | — |
MOD | — | yes | — | — | — | — |
NIL | — | — | — | — | — | yes |
NEW | — | — | — | — | — | yes |
DISPOSE | — | — | — | — | — | yes |
FOR | — | — | — | — | — | yes |
IN | — | — | — | — | — | yes |
TO | — | yes | yes | — | — | — |
FROM | — | yes | yes | — | — | — |
:: | — | yes | yes | yes | yes | — |
:= | yes | yes | yes | — | — | — |
. | — | — | — | — | yes | yes |
! | — | — | — | — | yes | yes |
+ | yes | yes | yes | yes | yes | — |
- | — | yes | yes | yes | yes | yes |
* | — | yes | yes | yes | — | — |
/ | — | — | yes | yes | — | — |
= | yes | yes | yes | yes | yes | — |
< | yes | yes | yes | — | — | — |
> | yes | yes | yes | — | — | — |