next up previous
Next: About this document ... Up: Enforcing Constraints Previous: Pascal Section 6.2.2.1

Pascal Section 6.2.2.7

When an identifier or label has a defining point for a region, another identifier or label with the same spelling can't have a defining point for that region.

Pascal Section 6.2.2.7[4]:
SYMBOL MultDefChk INHERITS Unique COMPUTE
  IF(NOT(THIS.Unique),
    message(
      ERROR,
      CatStrInd("Multiply defined identifier ",THIS.Sym),
      0,
      COORDREF));
END;

TREE SYMBOL LblIdDef INHERITS MultDefChk END;
TREE SYMBOL ConIdDef INHERITS MultDefChk END;
TREE SYMBOL TypIdDef INHERITS MultDefChk END;
TREE SYMBOL TagIdDef INHERITS MultDefChk END;
TREE SYMBOL VblIdDef INHERITS MultDefChk END;
TREE SYMBOL FmlIdDef INHERITS MultDefChk END;
This macro is defined in definitions 4 and 6.
This macro is invoked in definition 1.

MultDefChk requires the Eli Unique module.

Instantiate appropriate modules[5]:
$/Prop/Unique.gnrc :inst
This macro is defined in definitions 5.
This macro is invoked in definition 2.

Function and procedure identifiers present a problem because of the forward directive. FIXME For the moment, no messages will be issued for multiply-defined procedures or functions.

Pascal Section 6.2.2.7[6]:
TREE SYMBOL PrcIdDef INHERITS IdentOcc, IdDefScope END;
TREE SYMBOL FncIdDef INHERITS IdentOcc, IdDefScope END;
This macro is defined in definitions 4 and 6.
This macro is invoked in definition 1.
Program parameters have similar characteristics, except that they must have defining occurrences a variables in the program. The required identifiers input and output are exceptions to this rule -- their appearance in PgmPars constitutes their defining occurrence. FIXME That subtlety is not reflected in this specification.

FIXME This rather simplistic solution doesn't worry about multiple forward or non-forward declarations for the same routine. Strictly speaking, input and output should not be included in this list, since they are variables. A variable requires storage, and hence must have a defining point within the program. Defining them here means that there will be no error report if these identifiers are defined explicitly in the program block.


next up previous
Next: About this document ... Up: Enforcing Constraints Previous: Pascal Section 6.2.2.1
2008-08-29