From Modula-2 Reloaded

WiP: Verification Of Operator Bindings

=== This page is now out of date ===

Semantic Superset Types

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:

A-Type Bindings

The following bindings are permitted:

Example: SampleCollection

S-Type Bindings

The following bindings are permitted:

Example: STRING

Z-Type Bindings

The following bindings are permitted:

Examples: SampleUINT and SampleINT

R-Type Bindings

The following bindings are permitted:

Example: BCD

C-Type Bindings

The following bindings are permitted:

Example: COMPLEX

V-Type Bindings

The following bindings are permitted:

Example: SampleVector and SampleTuple

Common constraints

The following constraints are common to all semantic types:

Summary

 S-TypeZ-TypeR-TypeC-TypeV-TypeCollection
  TMINyesyes
  TMAXyesyes
  HIGHyes
  LENGTHyes
  COUNTyes
  ABSyesyesyesyes
  NEGyesyesyesyes
  ODDyes
  DIVyes
  MODyes
  NILyes
  NEWyes
  DISPOSEyes
  FORyes
  INyes
  TOyesyes
  FROMyesyes
  ::yesyesyesyes
  :=yesyesyes
  .yesyes
  !yesyes
  +yesyesyesyesyes
  -yesyesyesyesyes
  *yesyesyes
  /yesyes
  =yesyesyesyesyes
  <yesyesyes
  >yesyesyes
Retrieved from http://modula-2.net/m2r10/pmwiki.php?n=WiP.VerificationOfOperatorBindings
Page last modified on 2015-09-16 14:00