In Ocean you have (a) little control over alignment and the amount of padding used: either it is allowed and the system decides the amount based on the alignment constraints, or you indicate that padding is illegal and no padding (not even a bit) is inserted.
type-name ::= identifier base-type ::= atom | structure | array | class full-type ::= [[force] change] [[force] check] base-type define-type ::= full-type type-name
enum-elem ::= enum-value [list-start known-integer-value list-end] enum-def ::= enum-elem [or enum-elem]... range-def ::= known-integer-value range known-integer-value atom-constr ::= extend s enum-type-name [s] | align s lit-float [s] | order s (big_endian|little_endian) [s] atom ::= range [atom-constr [sep atom-const]...] spec range-def | enum [atom-constr [sep atom-const]...] spec enum-def | range-def | enum-def
context : the current type
The most basic form of a type is either a range of integer values, or a set of enum values. The amount of bits reserved is the minimum to store all the possible values without an offset, so 62..63 will still use 6 bits. If a negative value is present in the range or as a defined value of an enum-value, the range is automaticly two's complement, and all positive values will have a leading reset-bit.
If you need an 'offset' value, that is binary zero does not indicate the value zero, use unit alias to create a 'shifted' value.
The alignment default value is default 0 (for don't-care). It can either be an integer, in chich case it indicates the modulo of the byte-alignment, or a float 0.0 < a < 1 which indicates the modulo of the bit-alignment.
Bit allocation will always start at the lsb (least significant bit),
All these types are weakly alterable and unchecked.
known-integer-value : an expression which can be computed during compile time and results in an integer
'first': ::@::highest+7 | 'third': ::@::highest+7
Now first equals 7 and third equals 14; if we insert 'second' then we do not need te change `third`.
pointer-name ::= identifier count-label ::= label [s] format ::= identifier access-label ::= label [s] format ::= identifier [s] sep identifier reference ::= counted [s] [count-label] pointer-name | owner s pointer-name | pointer s pointer-name | access [s] [access-label] pointer-name struct-part ::= full-type s var-names [s] ( sep | concat ) variant-part ::= enum-value spec full-type s var-names or-else union-part ::= full-type s var-names or-else struct-constr ::= reference | align s lit-float [s] | invariant structure ::= list-start struct-part list-end | structure [struct-constr [sep struct-constr]] spec list-start struct-part... list-end | union spec list-start union-part... list-end | variant spec list-start spec identifier sep variant-part... list-end
A structure collects a number of different types into one type. Items will keep their ordering, but padding is optional: if you use the concatenation symbol (//), then the next item will have no alignment (even on the bit level!). Note that this can cause severe performance degrading if you use this on say Floats.
'Simple' structures have no reference information, so you can not have pointers to them. However, passing them with 'that' to a function is still allowed.
( 'float'|'integer' type; Boolean flag1// Boolean flag2, variant ( :type, 'float' : Float float, 'integer' : Integer integer, ) _, # an unnamed (so 'inlined') variant )
array-size ::= lit-integer | context | atom-type | class-with-hash-interface simple-array ::= index-start [array-size [s]] index-end full-type array ::= simple-array | array ownership simple-arrayArrays can be: