next up previous
Next: Array types Up: The Pascal type model Previous: Enumerated types

Subrange types

Subrange types[12]:
CLASS rangeType(hostType) BEGIN
  OPER
    rangeOrd(rangeType): intType;
    rangeNarrow(hostType): rangeType;
  COERCION
    (rangeType): hostType;
END;

INDICATION
  ordType: rangeOrd;
  assignCvt: rangeNarrow;
This macro is invoked in definition 3.

Establish a user-defined type[13]:
RULE: TypeDenoter ::=  constant '..' constant COMPUTE
  .CanonicalSet=NewType();
  TypeDenoter.GotType=
    ORDER(
      AddTypeToBlock(
        .CanonicalSet,
        SetTypes,
        SingleDefTableKeyList(constant[1].Type)),
      ResetCanonicalSet(TypeDenoter.Type,.CanonicalSet));
  TypeDenoter.GotOper=
    InstClass1(rangeType,TypeDenoter.Type,constant[1].Type);
END;
This macro is defined in definitions 4, 10, 13, 15, 16, 18, 21, and 23.
This macro is invoked in definition 1.



2008-08-29