Grammar Engineering Frequently Asked Questions
What is a type addendum statement, and when should I use one?
Type addendum statements are a recent extenion to tdl syntax
(as of 5/2005, LKB only, not yet interpreted by PET). Type
addendum statements allow you add information to a previously
defined type. Prior to the development of the Matrix, there wasn't
really a need for this kind of functionality: if you wanted to
add to a type, you could just edit its defintion. However, we
strongly discourage editing the matrix files (particularly
matrix.tdl) when building a grammar from the Matrix.
You may find that you would like to add a feature to an existing
type (notably the values of
HEAD), or add a constraint to an
existing type. To some extent, this can be done by adding subtypes,
but this can become awkward.
A type addendum statement looks like this:
existing-type :+ new-supertype &
"documentation string"
[ EXISTING-FEATURE more-specific-value,
NEW-FEATURE some-value ].
Unlike type definitions, type addendum statements use
:+
instead of
:=. Type addendum statements are only valid
with existing types. There must be at least one piece of information
after the
:+: a new supertype, a documentation string (in quotes),
or a constraint (in square brackets), or any combination of those.
Note that it's not valid to specify a supertype in a type addendum
which is already a supertype of the type in question.
In general, if you would like to add information to a type already
declared in the Matrix, a type addendum statement is the way to go.
For types that are defined in language-specific files, it's probably
best to avoid type addenda.
Related topics
Back to FAQs page
Back to main course page
--
EmilyBender - 18 May 2005
Topic revision: r1 - 2005-05-19 - 03:58:03 -
EmilyBender