An Object-Oriented program interface for IL in C++

The following does not include an interface for the parser, but only the IL lexical analyzer. The implementation of the OO methods will be taken up once the theory is reasonably complete.

The lexical analysis is passed to low-level C bit processing module to implement the Semantic Mapping Protocol (SMP) .

This code is part of a family of programs developed for natural and artificial language processing. For more about this, please see Skrintha's constructed language home page .


enum tense {present, past, future};

enum aspect {simple, continuous, perfect, imperfect, incipient};

enum gender {NULL, female, neuter, male};

enum person {first, second, third};

enum number {singular, dual, paucal, plural};

class Noun {
public:
    Noun(gender gen =NULL, number num =singluar, Noun* rel =NULL):
        g(gen), n(num), relativ(rel) {}
      // default constructor
    String id;       // object's name
    float getGender();       // compute the gender information
    float getNumber();       // compute the number information
    Noun* comp       //# noun within a noun phrase
      //# to which &this points, acting
      //# like an adjective
private:
    gender g;
    number n;
}

class Verb {
public:
    Verb(gender gen =NULL, number num =singluar, person per =third,
        aspect asp =simple, tense ten =present, Patient *trans =NULL):
        n(num), g(gen), p(per),     t(ten) {}
      //# default constructor; if no pointer to
      //# to a Patient object is supplied, &this
      //# is an intransitive verb
    String id;       // object's name
    float getTense();       // compute the tense information
    float getNumber();       // compute the number information
    float getGender();       // compute the gender information
    float getPerson();       // compute the person information
    Patient *trans;       // Pointer to patient for transitive verbs
private:
    gender g;
    number n;
    person p;
    tense t;
}

class Agent : public Noun {
public:
    Agent(gender gen=NULL, number num=singluar,
        Noun* rel =NULL, Verb* ver=NULL): Noun(gen, num, rel)
        {v = ver}
    // default constructor
    float agent();       // compute agent information
    float getVerb();       // compute agent action information
private:
    Verb *v;       // pointer to verb originating from agent
}
// The Attribute class template covers adjectives, adverbs and their qualifiers
// Adjective declaration:   Attribute<Noun>   x;
// Adverb declaration:   Attribute<Verb>   x;
// Adjective/Adverb qualifier declaration:   Attribute<Attribute<T>>   x;
class Patient : public Noun {
public:
    Agent(gender gen=NULL, number num=singluar,
        Noun* rel =NULL): Noun(gen, num, rel)
        {}
    // default constructor
    float agent();       // compute patient information
    float getVerb();       // compute action reception information
}
template < class T >
class Attribute {
public:
    Attribute(gender gen =NULL, number num =singluar, T* attrib =NULL):
        g(gen), n(num), a(attrib) {}
      // default constructor
    String id;       // object's name
    float getGender();       // compute the gender information
    float getNumber();       // compute the number information
    T* a       // pointer to the qualified class
private:
    gender g;
    number n;
}