예제 #1
0
 public AstReductionRule(AstTermBase head, AstTermBase tail)
 {
     if (!(head is AstTermBase) && !(head is AstTermProduct))
     throw new ArgumentException("Reduction rule head can only be term or term product.");
       Head = head;
       Tail = tail;
 }
예제 #2
0
 public AstReductionRule(AstTermBase head, AstTermBase tail)
 {
     if (!(head is AstTermBase) && !(head is AstTermProduct))
     {
         throw new ArgumentException("Reduction rule head can only be term or term product.");
     }
     Head = head;
     Tail = tail;
 }
 public static TrsTermBase ConvertAstTermBase(AstTermBase arg)
 {
     if (arg is AstConstant)
     {
         return(((AstConstant)arg).Convert());
     }
     else if (arg is AstVariable)
     {
         return(((AstVariable)arg).Convert());
     }
     else if (arg is AstString)
     {
         return(((AstString)arg).Convert());
     }
     else if (arg is AstNumber)
     {
         return(((AstNumber)arg).Convert());
     }
     else if (arg is AstNativeKeyword)
     {
         return(((AstNativeKeyword)arg).Convert());
     }
     else if (arg is AstTermProduct)
     {
         return(((AstTermProduct)arg).Convert());
     }
     else if (arg is AstTerm)
     {
         return(((AstTerm)arg).Convert());
     }
     else if (arg is AstAcTerm)
     {
         return(((AstAcTerm)arg).Convert());
     }
     else
     {
         throw new ArgumentException("Unexpected type: " + arg.GetType().FullName);
     }
 }
예제 #4
0
 public static TrsTermBase ConvertAstTermBase(AstTermBase arg)
 {
     if (arg is AstConstant) return ((AstConstant)arg).Convert();
       else if (arg is AstVariable) return ((AstVariable)arg).Convert();
       else if (arg is AstString) return ((AstString)arg).Convert();
       else if (arg is AstNumber) return ((AstNumber)arg).Convert();
       else if (arg is AstNativeKeyword) return ((AstNativeKeyword)arg).Convert();
       else if (arg is AstTermProduct) return ((AstTermProduct)arg).Convert();
       else if (arg is AstTerm) return ((AstTerm)arg).Convert();
       else if (arg is AstAcTerm) return ((AstAcTerm)arg).Convert();
       else throw new ArgumentException("Unexpected type: " + arg.GetType().FullName);
 }