lexicon Statement
The lexicon statement defines a lexicon which can later be incorporated into a grammar definition. It describes a series of text tokens and their equivalent numerical values.
The lexicon must be given a unique (within all other lexicons) code name by which it can be referred to. It then must contain the following sub-statements in between '{' and '}' braces.
lexicon Sub-Statement List | ||
---|---|---|
Sub-Statement | Use | Example |
name | Give the lexicon a text description. | name "Month names"; |
fieldname | The field name normally associated with this lexicon. | fieldname month; |
lang | The language used. (Not in use yet.) | lang en; |
pseudo | The text used by by the pseudo date to describe the lexicon. | pseudo Month, Mon"; |
tokens | A list of values, tokens and an optional abbreviation. | tokens {1, January, Jan; ...} |
name Sub-Statement
Gives a descriptive name to the lexicon. Used by the HistroyCal program when showing a 'pick-list' of available lexicons to select.
fieldname Sub-Statement
This statement links the lexicon to a particular field name for a given scheme. It can enable a scheme element to entered outside of the normal element ranking system. For example: "Sun Sep 1948" could be identified as all Sundays during September 1948. This is possible because Sunday is recognised as a weekday and so entered into the wday field rather than simply converted to its value of 1 and becoming "1 9 1948".
lang Sub-Statement
This statement sets the language for the lexicon. Multi-lingual versions of the program have not yet been developed, so this is a marker for the future.
pseudo Sub-Statement
The pseudo text is used by a format definition when creating the pseudo date used to show the intended output. The pseudo date is the text shown when selecting the output format, as in the string "dd Mon yyyy" for the dmy format. The 'Mon' in that string indicates that output will use the abbreviated value from the lexicon.
tokens Sub-Statement
A list of the value and token names. A second token for a value may be given to be used as an abbreviation.
Each token takes the form of a comer separated list of the value, token, optional abbreviaton terminated with a ';' semi-colon. The list of tokens is enclosed within '{' '}' braces.
If the token name does not conform to a script name token, then they must be enclosed in '"' double quotes.
Example Script |
---|
lexicon w { name "Weekday names"; fieldname wday; lang en; pseudo Weekday, WDay; tokens { 1, Monday, Mon; 2, Tuesday, Tue; 3, Wednesday, Wed; 4, Thursday, Thur; 5, Friday, Fri; 6, Saturday, Sat; 7, Sunday, Sun; } } |