next up previous
Next: File types Up: The Pascal type model Previous: Record types

Set types

FIXME: This implementation makes all sets of a given base type equivalent. That's probably not correct. See Pascal 6.4.3.4, 6.7.2.4.

Set types[17]:
CLASS setType(baseType) BEGIN
  OPER
    setop(setType,setType): setType;
    setmember(baseType,setType): boolType;
    setrel(setType,setType): boolType;
  COERCION
    (emptyType): setType;
END;

INDICATION
  plus: setop;
  minus: setop;
  star: setop;
  in: setmember;
  equal: setrel;
  lsgt: setrel;
  lessequal: setrel;
  greaterequal: setrel;
This macro is invoked in definition 3.

Establish a user-defined type[18]:
RULE: TypeDenoter ::= 'set' 'of' type COMPUTE
  .CanonicalSet=
    GetCanonicalSet(FinalType(type.Type),NoKey)
    <- INCLUDING RootType.GotUserTypes;
  TypeDenoter.GotOper=
    ORDER(
      Coercible(
        NoOprName,
        FinalType(TypeDenoter.Type),
        FinalType(.CanonicalSet)),
      MonadicOperator(
        assignCvt,
        NoOprName,
        FinalType(.CanonicalSet),
        FinalType(TypeDenoter.Type)),
      InstClass1(setType,TypeDenoter.Type,type.Type));
END;
This macro is defined in definitions 4, 10, 13, 15, 16, 18, 21, and 23.
This macro is invoked in definition 1.

Property definitions[19]:
SetTypes;
This macro is defined in definitions 11, 19, 24, 30, 34, and 38.
This macro is invoked in definition 7.


next up previous
Next: File types Up: The Pascal type model Previous: Record types
2008-08-29