2.2.3) Structures

Structures are compound types. Both input and output structures are treated in this section. Follows the description of all the structures:

Structure Description Examples
record
id:type
...
id:type
end
Record structure
This is a fixed length multi-type structure
record a:nat b:real end

{23 .345}


list of type List structure
This is a variable length single-type structure
list of nat

{2 3 4 6 7 8 3 4 2 3}
{3 4}


array(nat) of type Array structure
This is a fixed length single-type structure
array(5) of nat

{1 2 3 4 5}
but not {56 23 45 23}

case id of
nat id:type
...
nat id:type
else id:type
end
Case structure
In dependence of the first id, it can have different types

Else line is optional

case a of 1 b:nat c:real end

{1 23}
{2 .345}


Although input and output structures are syntactically identical, semantically they are not. Moreover, input types cannot be used inside output structures and vice versa.


Back to main page.
Send comments to: Igor Sfiligoi