Layouts
There are four different kind of layout definitions in TreeLDR:
Empty Layout
The empty layout is defined by simply declaring the name of the layout directly followed by a semicolon.
Structure Layout
A structure layout is a list of fields each bound to a property of the layout's type.
The layout of each field is specified after a colon :
using a layout expression.
Enumeration Layout
[To Do]
Layout Alias
Lastly, it is possible to define layout aliases. Such a layout is defined using a layout expression.
Layout Expression
A layout expression is a composition of existing layouts by union, intersection, and restriction.
Union
The union between two or more layouts is expressed using the |
operator.
Under the hood, this implicitly defines an enumeration layout.
Intersection
The intersection between two or more layouts is expressed using the &
operator.
Range Restriction
Range restrictions are used to select a subset of a layout by restricting the range of one of its fields. Just like with types, there are two kinds of range restrictions: universal and existential.
A universal range restriction is built using the all
keyword:
This denotes the layout of all instances such that all values of fieldName
are instances of RestrictedLayout
.
Similarly, the existential range restriction is built using the any
keyword:
This denotes the layout of all instances such that at least one value of fieldName
is an instance of RestrictedLayout
.
Range restrictions are usually part of an intersection:
Last updated