next up previous contents
Next: The Lexicon Up: Squirrel's Grammar and Previous: Squirrel's Grammar and

The Grammar

 

The grammar contains context-free rules of the form:

for example. This says that a sentence can be formed from a noun phrase and a verb phrase. Rules of this form are annotated with attribute-value restrictions. For example, the number of the subject (plural or singular in English) must match the number of the verb.

Additional features are used to indicate the mood of the sentence (whether it is a question or an assertion for example) and whether the sentence is really a sentential clause with a missing constituent (as might occur in relative clauses for example).

Further rules must indicate how the noun phrases and verb phrases categories can be formed.

In addition to attribute-value annotations, the grammar rules indicate how to compose a representations of the constituent categories.

The following examples are taken from the Squirrel grammar:

rule(s1a).
s -> [np,vp].      b(vp).
                   [s,mood]              = decl.
                   [np,case]             = subj.
                   [np,agreement]        = [vp,agreement].
                   [np,npslash]          = [s,npslash].
                   [vp,vform]            = fin.
                   [vp,npslash,slabel]   = nil.
                   [vp,aslash,slabel]    = nil.
                   [vp,vslash,slabel]    = nil.
                   [vp,neg]              = no.
                   [np,quest]            = no.
                   [vp,quest]            = no.
                   [vp,modal]            = no.
                   t(np):t(vp).
Each rule is uniquely labelled to assist the work of the parser.

The attribute annotations can be though of as forming a tree or graph. For example nouns have agreement attributes (number and case) that must match the function it serves when it occurs in a sentence. We can group both number and case under one attribute, namely agreement. Equations concerning agreement can then be expressed using the agreement rather than writing equations for both number and case. We can refer to the number and case by using a path such as agreement.number or agreement.case.

The parser is bidirectional. This means that it can try and work bottom-up from the data - the sentence itself - to form a sentence, or it can work top-down from a hypothesis that there is a sentence, or some other category, towards the words in the sentence. The first annotation (b(vp)) indicates whether the rule is intended to be used top-down or bottom-up. If the rule is to be used bottom-up (as here) then the annotation indicates which category must have been found to license the use of the rule (a vp in this case).



next up previous contents
Next: The Lexicon Up: Squirrel's Grammar and Previous: Squirrel's Grammar and



Chris Fox, September 1995