SCI Parser Programmer's Reference/User Parse Trees
Author: Pablo Ghenis
User Parse Trees
When a user types in a sentence, the sequence of words is used to create a parse tree that represents the syntactic structure of the sentence. This is done according to traditional grammar rules.
The parser uses two external resources: the dictionary and the grammar. The dictionary defines which words will be recognized and the grammar defines the rules used to analyze the sentence. Since both of these resources are external, they can be changed and recompiled. The dictionary is recompiled by typing VC (vocabulary compiler) and the grammar requires GC (grammar compiler). For information on how to modify these files, see your local friendly and infinitely patient SCI system programmer. :-)
All sentences typed during a game are imperative, that is, they constitute commands. An imperative sentence starts with a verb and is followed by optional direct and indirect objects.
Example: "take the gold from the dwarf"
root=vp | +=============+==================+ | | | root=verb dobj=np iobj=ap | | | "take" | | +=======+ +=========+ | | | | ignore root mod root art noun prep np "the" "gold" "from" | +=======+ ignore root art noun "the" "dwarf"
The above tree can also be written using parenthesized notation as follows:
Code:(root vp (root verb . 'take') (dobj np (ignore art . 'the') (root noun . 'gold') ) (iobj ap (mod prep . 'from') (root np (ignore art . 'the') (root noun . 'dwarf') ) ) )
take some time to look at this example and understand the new notation. For the sake of convenience it will be used throughout this document.
The grammar rules used to produce the above tree are:
|vp||= (root verb) (dobj np) (iobj ap)|
|np||= (ignore art) (root noun)|
|ap||= (mod prep) (root np)|
|verb||= from dictionary|
|art||= from dictionary|
|noun||= from dictionary|
|prep||= from dictionary|