Example #1
0
    public Term(OperatorDescr od) // Term consisting of an operator only (used at Term construction time only)
    {
      string op;
      int pr;
      OType ot;

      if (od.IsDefinedAsInfix(out op, out pr, out ot))
      {
        _functor = od.Name;
        arity = 2;
        oType = ot;
        oDescr = od;
        precedence = (short)pr;
      }
      else if (od.IsDefinedAsPrefix(out op, out pr, out ot))
      {
        _functor = od.Name;
        arity = 1;
        oType = ot;
        oDescr = od;
        precedence = (short)pr;
      }
      else if (od.IsDefinedAsPostfix(out op, out pr, out ot))
      {
        _functor = od.Name;
        arity = 1;
        oType = ot;
        oDescr = od;
        precedence = (short)pr;
      }
      fType = FType.opr;
    }
Example #2
0
 public Term(ClauseNode c)  // Create a Term from a ClauseNode (= Head + Body)
 {
   if (c.NextNode == null) // fact
   {
     Term t = c.Term;
     _functor = t._functor;
     arity = t.arity;
     args = t.args;
     varNo = t.varNo;
     ULink = t.ULink;
     fType = t.fType;
     oType = t.oType;
     oDescr = t.oDescr;
     precedence = t.precedence;
     hasValue = t.hasValue;
     isUnified = t.isUnified;
     isPacked = t.isPacked;
   }
   else
   {
     _functor = Parser.IMPLIES;
     arity = 2;
     args = new Term[2];
     args[0] = c.Term;
     fType = FType.comp;
     oType = OType.xfx;
     args[1] = TermSeq(c.NextNode);
     precedence = 1200;
   }
 }
Example #3
0
 public Term(string s, OperatorDescr od, Term[] a, OType ot, int prec)
 {
   _functor = s;
   args = a;
   arity = (short)a.Length;
   oDescr = od;
   fType = (arity == 0) ? FType.atom : FType.comp;
   oType = ot;
   precedence = (short)prec;
 }