Next: Lattice functors, Previous: SL syntax, Up: Compiler
The grammar record is the result of compilation of a grammar file, and represents all the information contained in the grammar file. The XDK makes use of two different kinds of grammar records:
Below, we display the type definition of the stateless grammar record:
grammar( usedDIDAs: DIDAs allDIDAs: DIDAs dIDADimension1Rec: DIDASLERec pnPrinciple1Rec: PnSLERec usedPns: Pns chosenPns: Pns pnCAPriITups: PnCAITups dIDAUsedOnsRec: DIDAOnsRec onOutput1Rec: OnSLERec chosenOns: Ons usedOns: Ons aEntriesRec: ASLERec as: As entriesI: I entry1Tn: Tn nodeTn: Tn node1Tn: Tn tnTypeRec: TnILTCoRec)
The value of the usedDIDAs
feature is a list of dimension
identifiers (DIDAs
) which are the used dimensions.
The value of the allDIDAs
feature is a list of dimension
identifiers (DIDAs
) which are all the dimensions defined in the
grammar.
The value of the dIDADimension1Rec
feature is a record mapping
dimension identifiers (DIDA
) to encoded dimension definitions
(SLE
).
The value of the pnPrinciple1Rec
feature is a record mapping
principle names
(Pn
) to encoded principle uses (SLE
). A principle name is
a unique name for a principle chosen on a dimension.1
The value of the usedPns
feature is a list of principle names
(Pns
) which are the used principles.
The value of the chosenPns
feature is a list of principle names
(Pns
) which are all the principles chosen in the
grammar.2
The value of the pnCAPriITups
feature is a list of tuples
Pn#CA#I
of a principle name (Pn
), a principle constraint
name CA
, and a priority (I
). These are all principle
constraints.
The value of the dIDAUsedOnsRec
feature is a record mapping
dimension identifiers (DIDA
) to the output names
of the outputs used used on that dimension. An output name is a unique
name for an output chosen on a dimension.3
The value of the onOutput1Rec
feature is a record mapping
output names (On
) to encoded output definitions (SLE
).
The value of the chosenOns
feature is a list of the chosen output
names.
The value of the usedOns
feature is a list of the used output
names.
The value of the aEntriesRec
feature is a record mapping words
(A
) to their corresponding encoded lexical entries (SLE
).
This record is empty if the lexicon is stored into a database.
The value of the as
feature is the list of all words
(As
) in the lexicon.
The value of the entriesI
feature is an integer denoting the
number of lexical entries of the grammar.
The value of the entry1Tn
feature is the type name (Tn
)
corresponding to the type of a lexical entry.
The value of the nodeTn
feature is the type name (Tn
)
corresponding to the type of a node record, including the features
word
, index
, nodeSet
and entryIndex
, and
excluding the subrecords corresponding to the dimensions.
The value of the node1Tn
feature is the type name (Tn
)
corresponding to the type of a complete node record, including the
features of the type nodeTn
plus the attrs
, entry
and model
features from the individual dimensions.
The value of the tnTypeRec
feature is a record mapping type names
(Tn
) to their corresponding types (ILTCo
).
Notice that ILTCo
types are different form IL
types in
various respects:
args
of the type
are converted from IL constants to Oz atoms
CIL_i#IL_i
(1<=i<=n
) is converted to an Oz
record containing features A_i:IL_i
(where Oz atom A_i
corresponds to IL constant CIL_i
).
Below, we display the type definition of the features extending a stateless grammar record into a stateful grammar record:
grammar( dIDADimensionRec: DIDASLCRec dIDA2AttrsLat: DIDA2Lat dIDA2EntryLat: DIDA2Lat dIDA2LabelLat: DIDA2Lat pnPrincipleRec: PnSLCRec pn2Principle: Pn2SLC pn2ModelLat: Pn2Lat pn2DIDA: Pn2DIDA pnIsActive: PnIsActive procProcPnCAPriITups: ProcProcPnCAITups onOutputRec: OnSLCRec onOutputTups: OnSLCTups checkAsInEntries: As2U as2ABRec: As2ABRec as2AEntriesRec: As2AEntriesRec entry1Lat: Lat nodeLat: Lat node1Lat: Lat)
The value of the dIDADimensionRec
feature is a record mapping
dimension identifiers (DIDA
) to compiled dimension definitions
(SLC
).
The value of the dIDA2AttrsLat
feature is a function from
dimension identifiers (DIDA
) to the lattice corresponding to the
attributes type on that dimension (Lat
).
The value of the dIDA2EntryLat
feature is a function from
dimension identifiers (DIDA
) to the lattice corresponding to the
entry type on that dimension (Lat
).
The value of the dIDA2LabelLat
feature is a function from
dimension identifiers (DIDA
) to the lattice corresponding to the
label type on that dimension (Lat
).
The value of the pnPrincipleRec
feature is a record mapping
principle names (Pn
) to compiled principle uses
(SLC
).
The value of the pn2Principle
feature is a function from
principle names (Pn
) to compiled principle uses (SLC
).
The value of the pn2ModelLat
feature is a function from
principle names (Pn
) to the lattice corresponding to the type
of the model record introduced by that principle
(Lat
).
The value of the pn2DIDA
feature is a function from principle
names (Pn
) to dimension identifiers corresponding to the
dimension on which the principle is used (DIDA
).
The value of the pnIsActive
feature is the function
PnIsActive: Pn UsedDIDAs UsedPns -> B
, returning for principle
Pn
, whether it is active given used dimension IDs
UsedDIDAs
and used principle names UsedPns
.
The value of the procProcPnCAPriITups
feature is a list of
tuples Proc#Proc1#Pn#CA#I
of a constraint procedure
(Proc
), a profile procedure (Proc1
), a principle name
(Pn
), a principle constraint name (CA
) and a priority
(I
). These are all principle constraints.
The value of the onOutputRec
feature is a record mapping output
names (On
) to compiled output uses (SLC
).
The value of the onOutputTups
feature is a list of tuples
On#Output
of an output name (On
) and an output
(Output
). These tuples represent the mapping already contained
in the value of the onOutputRec
feature. The difference is that
they are ordered alphabetically (by their name and their dimension
name) to match the order of the outputs in the Outputs menu in the
GUI.
The value of the checkAsInEntries
feature is a function from
lists of words (As
) to unit (U
), raising an exception if
any word A
in As
is not contained in the lexicon.
The value of the as2ABRec
feature is a function from lists of
words (As
) to records mapping words (A
) to bool
(B
). For all A
in As
, B
is true if
A
is contained in the lexicon, and false otherwise.
The value of the as2Entries
feature is a function from lists of
words (As
) to records mapping words (A
) to lists of
compiled lexical entries for that word (Entries
).
The value of the entry1Lat
feature is the lattice (Lat
)
corresponding to the type of a lexical entry.
The value of the nodeLat
feature is the lattice (Lat
)
corresponding to the type of a node record, including the features
word
, index
, nodeSet
and entryIndex
, and
excluding the subrecords corresponding to the dimensions.
The value of the node1Lat
feature is the lattice (Lat
)
corresponding to the type of a node record, including the features
word
, index
, nodeSet
and entryIndex
, and
the subrecords corresponding to the dimensions.
[1] Contrary to principle names, principle identifiers are not unique because the same principle can be used on several dimensions.
[2] The distinction between chosen and used principles
makes sense for the graphical user interface: here, the
Principles
pull-down menu displays all chosen principles, of which
only the selected principles are actually used for solving.
[3] Like principles, contrary to output names, output identifiers are not unique because the same output can be chosen on several dimensions.