public ParserBinder(ParserBinderType OpType, string VariableName, ParserType VariableType, ParserExpression Expr)
 {
     this.OpType       = OpType;
     this.VariableName = VariableName;
     this.Expr         = Expr;
     this.VariableType = VariableType;
 }
 public ParserProdType(ParserType Left, ParserType Right)
 {
     this.Flags = ParserTypeFlags.Pair;
     // inherit some of the flags from the children
     this.Flags = this.Flags | (Left.Flags & Right.Flags & ParserTypeFlags.PairInheritable);
     this.Left  = Left;
     this.Right = Right;
     this.Typ   = ParserTypeEnum.Pair;
 }
 public ParserRec(ParserExpression Input, ParserExpression Start,
                  string NumVariableName, string AccVariableName, ParserType AccType, ParserExpression Step)
 {
     this.Input           = Input;
     this.Start           = Start;
     this.NumVariableName = NumVariableName;
     this.AccVariableName = AccVariableName;
     this.Step            = Step;
     this.AccType         = AccType;
 }
 public override bool Equivalent(ParserType Other)
 {
     if (Other.Typ == ParserTypeEnum.Logic)
     {
         return(true);
     }
     else if (Other.Typ == ParserTypeEnum.Unknown)
     {
         if (Other.Flags == 0 || Other.Flags == ParserTypeFlags.Logic)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public override bool Equivalent(ParserType Other)
 {
     if (Other.Typ == ParserTypeEnum.Lambda)
     {
         var OtherLambda = (ParserLambdaType)Other;
         return(InputType.Equivalent(OtherLambda.InputType));
     }
     else if (Other.Typ == ParserTypeEnum.Unknown)
     {
         if ((Other.Flags & (~ParserTypeFlags.Lambda)) == 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public override bool Equivalent(ParserType Other)
 {
     if (Other.Typ == ParserTypeEnum.Pair)
     {
         var OtherPair = (ParserProdType)Other;
         return(Left.Equivalent(OtherPair.Left) && Right.Equals(OtherPair.Right));
     }
     else if (Other.Typ == ParserTypeEnum.Unknown)
     {
         if ((Other.Flags & (~ParserTypeFlags.Pair)) == 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public override bool Equivalent(ParserType Other)
 {
     if (Other.Typ == ParserTypeEnum.Number)
     {
         return(true);
     }
     else if (Other.Typ == ParserTypeEnum.Unknown)
     {
         if ((Other.Flags & (ParserTypeFlags.Logic | ParserTypeFlags.Pair | ParserTypeFlags.Lambda
                             | ParserTypeFlags.Compact)) == 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public override bool Equivalent(ParserType Other)
 {
     return(true);
 }
 public abstract bool Equivalent(ParserType Other);
 public ParserLambdaType(ParserType InputType)
 {
     this.Flags     = ParserTypeFlags.Lambda;
     this.InputType = InputType;
     this.Typ       = ParserTypeEnum.Lambda | ParserTypeEnum.Logic;
 }