Sortal Description Language | Index | |
Sorts Sorts are class structures, either specifying a single data type or a composition of other class structures. We distinguish five types of sorts: primitive sorts, attribute sorts, disjunctive sorts, recursive sorts and aspect sorts.
A sort is defined by its name and an associated expression. An aspect sort has two or more names, one for each aspect. The name of a sort may include the specification of a profile name, which is necessary if the sort is used under a different profile than the one it has been defined under. More on profiles
All component sorts in the definition of a sort must be defined either before, or, at the time of the specification.
That is, a sort expression may contain other sort definitions. The definition of a sort is preceded by the keyword sort and followed by a semicolon. sort sort-definition ; sort-definition sort-name : sort-specification ( aspects ) : aspects-specification sort-name identifier sort-name profile-name ' identifier profile-name identifier sort-specification [ characteristic ] [ characteristic ] ( arguments ) sort-expression aspects sort-name , sort-name aspects-specification [ Property ] ( sort-name , sort-name ) sort-expression sort-term sort-term + sort-expression sort-term sort-factor sort-factor ^ sort-term sort-factor sort-name ( sort-expression ) ( sort-definition ) arguments argument argument , arguments { enumeration-values } , [ rankings ] argument number identifier "string" enumeration-values identifier identifier , enumeration-values rankings identifier identifier rankings The terms identifier, number (floating-point number) and string follow the normal conventions. Though the attribute relationship only applies to a primitive sort in conjunction with any other sort, the attribute operator (^) may be applied to any two sorts.
The following two rules (associative and distributive) specify the result of the attribute operation in the case that the first operand is not a primitive sort. In the case of the operation of sum (+), the following associative rule applies if (a + b) is not named.
Furthermore, any sort that appears more than once in the expression of sum is replaced by a single occurrence: Some characteristic individuals allow for the specification of one or more arguments, one or two require this.
Examples sort points : [Point]; // A sort of points sort labeledpoints : points ^ (labels : [Label]); // A sort of labeled points defined from the sort of // points and a sort of labels under the attribute // relationship sort (has_labels, has_points) : [Property] (points, labels); // A sort of properties between points and labels. This // sort defines two aspects has_labels and has_points sort points_and_labels : points ^ has_labels + labels ^ has_points; // A disjunctive sort of points and labels, each as an // attribute sort with the respective properties' aspect sort lines : [LineSegment]; // A sort of line segments, named lines sort functions_on_lines : (functions : [Function]) ^ lines; // A sort of functions with lines as attributes sort weights : [Weight] (1.0); // A sort of fractional weights sort labeltree : (labelnode : (labels ^ ((left : labeltree) + (right : labeltree))) + labels // A sort of binary trees of labels recursively defined // as the sum of the sort of labels and the sort of // labelnodes, itself defined as the attribute // operation over the sort of labels and the sum of // twice the sort of binary trees of labels, resp., // denoted left and right Two forward slashes (//) denote a comment, everything from the slashes until the end of the line is ignored. |
||
Last update: 3 July 2012, webmaster @ sortal.org |
||