Go to the first, previous, next, last section, table of contents.

# Information of the SET_TYPE implementation in GPC.

Juki <jtv@hut.fi>
Last modified: Wed Sep 22 11:47:27 1993

- Memory format `Set of T` type nodes are represented as bit vectors, one bit for each element. The SET_TYPE objects contain only the bits necessary to represent the set type PLUS the padding to align the objects to the nearest word boundary. Thus, there may be unused bits in front and after the end of otherwise contiquous bit vector that represents all the elements of the set.
- Sparse sets are not implemented there is no concept of "sparse sets", which I thought might be nice for things like `[ -maxint, maxint ]` to work. Maybe someone implements this later, e.g. with a list of set fragments or a list of set elements.
- Negative bounds for sets do not work Perhaps this could be done by subtracting the low bound from all set elements before storing them to bitvectors. (This might cause complications with set constructors in expressions?)
- Set of integer This is a problem currently. It should be dynamic, but currently the bounds are always set to 0..255 for an unlimited integer set. First aid: implement a switch that specifies the bounds of such sets. The value should be passed to `setop.c` in some language independend way. (Global variables :-)
- Set operations: With a massive hack attack I converted all set operations to inline code. It is not perfect yet, but now it passes all set tests I have. Yet, the code contains unimplemented parts (see `setop.c`).
- List of set operations:

    CARD_EXPR:      returns the number of set elements currently in the set
                    Extended Pascal.

    UNION           SetC := SetA + SetB; union of the sets
    BIT_OR_EXPR

    DIFF            SetC := SetA - SetB; If in A, but not in B.
    BIT_ANDTC_EXPR  (and tc_optab has vanished from gcc-2, so this
                    will be done "SetA and (not (SetB))")

    INTERSECTION    SetC := SetA * SetB; If in A and in B
    BIT_AND_EXPR

    SYMDIFF         SetC := SetA >< SetB; set symmetric difference
    BIT_XOR_EXPR    (C if only in A or only in B (Boolean XOR)
                    Extended Pascal.

    SEARCH_EXPR:    in a set iteration, yields each member of the set
                    in some implementation dependend order.
                    Extended Pascal (this is not yet implemented in gpc).

    Rest of the operands result in boolean values.

    =, <>           Equality comparisons

    <=              LE_EXPR
                    SetA <= SetB denotes the inclusion of SetA in SetB

    >=              Implemented with LE_EXPR, like above
                    SetA >= SetB denotes the inclusion of SetB in SetA

Go to the first, previous, next, last section, table of contents.