Struct Types
Syntax
Struct :
struct
{
StructFields*}
StructFields :
StructFieldDec (,
StructFieldDec )*,
?StructFieldDec:
.
TYPE_IDENTIFIER:
Type
Structs are used to represent objects with fields. They are analogous to structs in C or record types in languages such as OCaml.
Example:
You may create a struct representing a point in 2D space the following way:
struct {
.x: int,
.y: int,
}