the-sett/salix/1.0.0

NOTE: the latest version is 4.0.3

L3

Defines the level 3 language for data models that have been annotated with predicates indicating that the model has particular features needed by particular code generators. A level 3 language ensures the specific requirements for futher processing by a code generator are being met.

The L3 data modelling language.

type alias L3 pos =
{ properties : Properties
, declarations : Dict String (Declarable pos RefChecked)
}

The L3 model

Defaulting of properties accross the data model, and APIs to read properties.

type alias DefaultProperties =
{ top : ( PropSpecs, Properties )
, alias : ( PropSpecs, Properties )
, sum : ( PropSpecs, Properties )
, enum : ( PropSpecs, Properties )
, restricted : ( PropSpecs, Properties )
, fields : ( PropSpecs, Properties )
, unit : ( PropSpecs, Properties )
, basic : ( PropSpecs, Properties )
, named : ( PropSpecs, Properties )
, product : ( PropSpecs, Properties )
, emptyProduct : ( PropSpecs, Properties )
, container : ( PropSpecs, Properties )
, function : ( PropSpecs, Properties )
}

Allows the default properties on parts of the model to be defined.

type alias PropertiesAPI pos =
{ top : PropertyGet
, declarable : Declarable pos RefChecked -> PropertyGet
, field : Properties -> PropertyGet
, type_ : Type pos RefChecked -> PropertyGet
}

An API for supplying property readers for various parts of the data model.

type alias PropertyGet =
{ getStringProperty : String -> ResultME PropCheckError String
, getEnumProperty :
Enum String -> String -> ResultME PropCheckError String
, getQNameProperty :
String -> ResultME PropCheckError (List String)
, getBoolProperty : String -> ResultME PropCheckError Bool
, getOptionalStringProperty :
String -> ResultME PropCheckError (Maybe String)
, getOptionalEnumProperty :
Enum String -> String -> ResultME PropCheckError (Maybe String)
}

An API for reading properties of various expected kinds.

makePropertiesAPI : DefaultProperties -> L3 pos -> PropertiesAPI pos

Creates a properties API from a set of defaulted property specs, and an L3 model.

Definition of an L3 processor which creates some output from an L3 model.

type alias Processor pos err =
{ name : String
, defaults : DefaultProperties
, check : L3 pos -> ResultME err (L3 pos)
, errorToString : (pos -> String) -> pos -> err -> String
}

API for an L3 model processor.

= CheckedPropertyMissing String PropSpec
| CheckedPropertyWrongKind String PropSpec

Once properties have been checked, then reading properties as per the property specification should always succeed, since those properties have been verified to be present and of the correct kind.

If reading a property fails, it is a coding error and should be reported as a bug. This error type enumerates the possible properties bugs.

Convert prop check errors to strings.