Examples of the TYPE Attribute

The following declarations are examples of other ways the TYPE attribute can be used:

DECLARE INT FIXED BIN(31);

/* DEFINE AN OPERATION ON CHARACTERS */ 
DECLARE RADIANS ENTRY( TYPE(INT), TYPE(INT) ) 
RETURNS( TYPE(INT) );

/* DEFINE ABSTRACT DATA TYPE */ 
DECLARE 1 LIST,
      2 HEAD POINTER,
   2 TAIL POINTER;

/* DEFINE OPERATION ON 'LISTS' */
DECLARE EXTEND_LIST ENTRY( TYPE(LIST),POINTER )
       RETURNS( TYPE(LIST) );

/* DEFINE AN ABSTRACT DATA TYPE */
DECLARE 1 COMPLEX_INTEGER, 
   2 REAL TYPE( INTEGER ), 
   2 IMAGINARY TYPE( INTEGER );

/* DEFINE OPERATIONS ON COMPLEX_INTEGER */
DECLARE (CIADD, CISUB, CIDIV, CIMUL) 
   ENTRY( TYPE(COMPLEX_INTEGER),
            TYPE(COMPLEX_INTEGER) )
   RETURNS( TYPE(COMPLEX_INTEGER) );