Structural Operators

The following is the documentation for binary structural operators.

Variable access

Syntax: x = a

Description: Sets x to the value of a. Also called a dereference, as a variable technically is a reference to a piece of memory.

Exceptions:

  • Unassigned, if the variable has not been assigned a value.

Relaxations:

  • Exception

Structure Accessor

Syntax: x = a.b

Description: Sets x to the value of element b in a. a is a variable of a structural type. The structural type has an element b.

For more information on structures, see structures.

Array Accessor

Syntax: x = a[b]

Description: Sets x to the (b-1)‘th element of a. a is a variable of array type. The first index of an array is 0.

Exceptions:

  • Out of bounds, if b is less than zero or more than or equal to the size of a.

Relaxations:

  • Exception

Array Length

Syntax: x = a.length or x = |a|

Description: Sets x to the length of a. a is a variable of array type.

Allocation operator

Syntax: x = new a

Description: Sets x to a new unassigned variable of type a. a must be a type descriptor.

Exceptions:

  • Unable to allocate, if allocation failed.

Relaxations:

  • Exception

Dealocation operator

Syntax: delete a

Description: Unallocates variable a.

Exceptions:

  • Unable to deallocate, if deallocation failed.

Relaxations:

  • Exception