METHODOLOGY AND  IMPLEMENTATION 

SYNTAX ANALYSIS

For parsing we have used Yacc specifications We realized that we have very few verbs to work with and all of their concurrence requirement can be handled giving all combinations of them  unique identities. In terms of Yacc specifications we need just three terminals for all kinds of verbs used in this restricted domain.

Names for terminals are formed by concatenating the complement list to 'V' . So verbs with same requirement of same complement list are in same category.
 

  • V_NP  verb having one complement NP.
  • V_PP  verb having one complement PP
  • V_NP_OR_PP  verb having one NP or one PP as it's complement.
  • N for Noun
  • D for Determiner
  • P for preposition
  • A for adjectives
  • N_OR_A

  •  

     
     
     

             Some of the words like 'left' are inherently ambiguous in there correct type. There correct category depends on the position they occur in the sentence. Consider these two sentences-

  • turn left.
  • go to the first left building.
  • In the first sentence it is a noun and in the second case it's an adjective. So we can specify it's correct category in the lexicon. We have specified it as N_OR_A . we decide about the correct category in at the time of parsing using some time of lookahead to find the category of the next token coming after this token.
                The first sentence is a interesting one because it has two words both having ambiguous categories. 'turn' is a noun and verb both, depending on the context. Still we don't have another 'OR' type token for handling these kind of verbs. Instead we handle this thing too at the time of parsing. we have two entries for this word in the dictionary and depending on the context (Some Flags set) the dictionary lookup routine skips the first one and takes the second and vice versa.

    SEMANTIC ANALYSIS

    Rules for semantics are inspired by the semantic phrase structure rules of HPSG .As parsing is done by Yacc ,from lexical semantics of different words, semantics of phrases are constructed and finally the semantics of whole sentence is constructed . The semantics of the sentence is a robotic procedure with all of it's arguments. At this time the procedure is run and the appropriate action takes place.
     

    LEXICAL SEMANTICS :

            In the lexicon all parts of speech are represented by a C structure struct phr . Semantics of all the words are grouped into four groups.
  • Noun phrase semantics
  • Functional semantics
  • Modifier semantics
  • Conjunctional semantics

  •           Noun phrase semantics is just a structure with 4 fields. Functional semantics is a structure which represent a robotic procedure with it's argument. The representation of a well formed sentence is this structure with all it's argument requirement fulfilled. Modifier semantics is used for prepositions and adjectives .
    they modify some existing structure . Conjunctional semantics is used for conjunctures like 'and' and 'until' . they take two valid procedure each representing the sentences it is joining and generate some sequence of those programs. So it does not change the internal structure of the input procedures.