protected IEnumerable <Proposition> ConvertFromAST(AST ast, Language.Symbol oper) { if (ast == null) { return(null); } List <Proposition> result = new List <Proposition>(); string type = ast.GetType().Name; if (type == "ASTOpBinary") { ASTOpBinary opBin = ast as ASTOpBinary; if (opBin.value == oper) { result.AddRange(ConvertFromAST(opBin.left, oper)); result.AddRange(ConvertFromAST(opBin.right, oper)); return(result); } } // else result.Add(Proposition.FromAST(ast)); return(result); }
// transitional constructor public BinaryOperation(ASTOpBinary ast) { Left = Proposition.FromAST(ast.left); Right = Proposition.FromAST(ast.right); }
// transitional constructor. public UnaryOperation(ASTOpUnary ast) { P = Proposition.FromAST(ast.ast); }